# yashr-cmd/doom-the-titans-__-jvmti-agent architecture

> Architecture diagram of the GitHub repository yashr-cmd/doom-the-titans-__-jvmti-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yashr-cmd/doom-the-titans-__-jvmti-agent
- Repository: https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent

## Overview

DTT is a pure-C JVMTI agent that protects selected DOOM The Titans classes from in-process tampering. It initializes inside the JVM, observes protected-class loading and redefinition, and uses both a class-load hook and a periodic live-bytecode watchdog; detected changes are restored from cached known-good bytes where possible, with repeat offenses reflected to the hostile thread. A separate vanilla-class guard injects checks that call the Java helper. The README documents the scope and fail-safe behavior; unsampled module internals are represented only where their interfaces or documented roles support the relationship.

Main entry points: [`dtt_native_agent/src/dtt_agent.c`](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_agent.c) (Native agent), [`dtt_native_agent/src/dtt_callbacks.c`](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_callbacks.c) (JVMTI callbacks), [`dtt_native_agent/src/dtt_watchdog.c`](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_watchdog.c) (Bytecode watchdog), [`dtt_native_agent/src/dtt_vanilla_guard.c`](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_vanilla_guard.c) (Vanilla guard injection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lifecycle["Agent lifecycle"]
  node_agent["Native agent<br/>[dtt_agent.c]"]
end

subgraph group_detection["Detection and repair"]
  node_callbacks["JVMTI callbacks<br/>[dtt_callbacks.c]"]
  node_protected["Protected-class policy<br/>[dtt_protected.c]"]
  node_watchdog["Bytecode watchdog<br/>[dtt_watchdog.c]"]
  node_cache["Baseline cache<br/>[dtt_cache.c]"]
  node_threads["Thread response<br/>[dtt_threads.c]"]
end

subgraph group_guards["Vanilla guards"]
  node_vanilla["Vanilla guard injection"]
  node_classfile["Classfile patcher<br/>[dtt_classfile.c]"]
  node_helper["Java protection helper"]
end

subgraph group_support["Runtime support"]
  node_bridge["Java reporting bridge<br/>[dtt_bridge.c]"]
  node_java_bridge["Java native bridge"]
  node_auth["Transform authorization<br/>[dtt_auth.c]"]
  node_log["Logging<br/>[dtt_log.c]"]
  node_platform["Platform support<br/>[dtt_platform.h]"]
end

node_jvm(("JVM"))

node_jvm -->|"loads agent"| node_agent
node_agent -->|"registers callbacks"| node_callbacks
node_agent -->|"starts watchdog"| node_watchdog
node_callbacks -->|"checks classes"| node_protected
node_callbacks -->|"intercepts classes"| node_vanilla
node_callbacks -->|"handles offenses"| node_threads
node_callbacks -->|"restores baseline"| node_cache
node_watchdog -->|"checks baseline"| node_cache
node_watchdog -->|"scans protected classes"| node_protected
node_vanilla -->|"patches bytecode"| node_classfile
node_vanilla -->|"injects helper calls"| node_helper
node_agent -->|"reports incidents"| node_bridge
node_bridge -->|"calls native bridge"| node_java_bridge
node_callbacks -->|"checks authorization"| node_auth
node_agent -->|"initializes tracking"| node_threads
node_agent -->|"initializes cache"| node_cache
node_callbacks -->|"logs events"| node_log
node_agent -->|"selects platform support"| node_platform
node_watchdog -->|"logs detections"| node_log

click node_agent "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_agent.c"
click node_callbacks "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_callbacks.c"
click node_protected "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_protected.c"
click node_watchdog "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_watchdog.c"
click node_cache "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_cache.c"
click node_threads "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_threads.c"
click node_vanilla "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_vanilla_guard.c"
click node_classfile "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_classfile.c"
click node_helper "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/java/runtime/PreatorGodHelper.java"
click node_bridge "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_bridge.c"
click node_java_bridge "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/java/runtime/NativeIntegrityBridge.java"
click node_auth "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_auth.c"
click node_log "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_log.c"
click node_platform "https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/include/dtt_platform.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_agent toneBlue
class node_callbacks,node_protected,node_watchdog,node_cache,node_threads toneAmber
class node_vanilla,node_classfile,node_helper toneMint
class node_bridge,node_java_bridge,node_auth,node_log,node_platform toneRose
class node_jvm toneIndigo
```

## Components

### Agent lifecycle

- [Native agent](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_agent.c): `dtt_native_agent/src/dtt_agent.c`

### Detection and repair

- [JVMTI callbacks](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_callbacks.c): `dtt_native_agent/src/dtt_callbacks.c`
- [Protected-class policy](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_protected.c): `dtt_native_agent/src/dtt_protected.c`
- [Bytecode watchdog](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_watchdog.c): `dtt_native_agent/src/dtt_watchdog.c`
- [Baseline cache](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_cache.c): `dtt_native_agent/src/dtt_cache.c`
- [Thread response](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_threads.c): `dtt_native_agent/src/dtt_threads.c`

### Vanilla guards

- [Vanilla guard injection](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_vanilla_guard.c): `dtt_native_agent/src/dtt_vanilla_guard.c`
- [Classfile patcher](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_classfile.c): `dtt_native_agent/src/dtt_classfile.c`
- [Java protection helper](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/java/runtime/PreatorGodHelper.java): `dtt_native_agent/java/runtime/PreatorGodHelper.java`

### Runtime support

- [Java reporting bridge](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_bridge.c): `dtt_native_agent/src/dtt_bridge.c`
- [Java native bridge](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/java/runtime/NativeIntegrityBridge.java): `dtt_native_agent/java/runtime/NativeIntegrityBridge.java`
- [Transform authorization](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_auth.c): `dtt_native_agent/src/dtt_auth.c`
- [Logging](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/src/dtt_log.c): `dtt_native_agent/src/dtt_log.c`
- [Platform support](https://github.com/yashr-cmd/doom-the-titans-__-jvmti-agent/blob/main/dtt_native_agent/include/dtt_platform.h): `dtt_native_agent/include/dtt_platform.h`

### Other components

- **JVM**

## Connections

- JVM → Native agent: loads agent (evidence: `README.md`)
- Native agent → JVMTI callbacks: registers callbacks (evidence: `dtt_native_agent/src/dtt_agent.c`)
- Native agent → Bytecode watchdog: starts watchdog
- JVMTI callbacks → Protected-class policy: checks classes (evidence: `dtt_native_agent/src/dtt_callbacks.c`)
- JVMTI callbacks → Vanilla guard injection: intercepts classes (evidence: `dtt_native_agent/src/dtt_callbacks.c`)
- JVMTI callbacks → Thread response: handles offenses (evidence: `dtt_native_agent/src/dtt_callbacks.c`)
- JVMTI callbacks → Baseline cache: restores baseline (evidence: `dtt_native_agent/src/dtt_callbacks.c`)
- Bytecode watchdog → Baseline cache: checks baseline (evidence: `dtt_native_agent/src/dtt_watchdog.c`)
- Bytecode watchdog → Protected-class policy: scans protected classes (evidence: `dtt_native_agent/src/dtt_watchdog.c`)
- Vanilla guard injection → Classfile patcher: patches bytecode (evidence: `dtt_native_agent/src/dtt_vanilla_guard.c`)
- Vanilla guard injection → Java protection helper: injects helper calls
- Native agent → Java reporting bridge: reports incidents (evidence: `README.md`)
- Java reporting bridge → Java native bridge: calls native bridge (evidence: `dtt_native_agent/src/dtt_bridge.c`)
- JVMTI callbacks → Transform authorization: checks authorization (evidence: `dtt_native_agent/src/dtt_callbacks.c`)
- Native agent → Thread response: initializes tracking (evidence: `dtt_native_agent/src/dtt_agent.c`)
- Native agent → Baseline cache: initializes cache (evidence: `dtt_native_agent/src/dtt_agent.c`)
- JVMTI callbacks → Logging: logs events (evidence: `dtt_native_agent/src/dtt_callbacks.c`)
- Native agent → Platform support: selects platform support (evidence: `dtt_native_agent/src/dtt_agent.c`)
- Bytecode watchdog → Logging: logs detections (evidence: `dtt_native_agent/src/dtt_watchdog.c`)
