# zenomt/rtmfp-cpp architecture

> Architecture diagram of the GitHub repository zenomt/rtmfp-cpp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zenomt/rtmfp-cpp
- Repository: https://github.com/zenomt/rtmfp-cpp

## Overview

This is a C++ RTMFP library for clients, servers, and peer-to-peer applications. The main workflow begins when a host configures platform and cryptography adapters, registers network interfaces, and opens or accepts flows; RTMFP establishes secure sessions and carries ordered, deadline-aware messages to peers. Distinct protocol stages include packet/interface handling, session keying, flow/message transfer, and optional Tin-Can media streaming or redirector-based load balancing. The tree and README support these subsystem boundaries; sampled excerpts confirm selected session, flow synchronization, crypto, and redirector behavior, but not every internal call path.

Main entry points: [`src/RTMFP.cpp`](https://github.com/zenomt/rtmfp-cpp/blob/main/src/RTMFP.cpp) (RTMFP engine), [`src/TCConnection.cpp`](https://github.com/zenomt/rtmfp-cpp/blob/main/src/TCConnection.cpp) (Tin-Can connection), [`src/Session.cpp`](https://github.com/zenomt/rtmfp-cpp/blob/main/src/Session.cpp) (Sessions), [`src/SendFlow.cpp`](https://github.com/zenomt/rtmfp-cpp/blob/main/src/SendFlow.cpp) (Send flows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Host integration"]
  node_platform["Platform adapter<br/>[rtmfp.hpp]"]
  node_posixadapter["POSIX adapters"]
  node_runloops["Run loops<br/>[RunLoops.hpp]"]
  node_performer["Performer<br/>[Performer.cpp]"]
  node_cryptoapi["Crypto adapter API<br/>[rtmfp.hpp]"]
  node_flashcrypto["Flash crypto"]
  node_openssl["OpenSSL crypto"]
  node_plaincrypto["Plain crypto"]
end

subgraph group_protocol["RTMFP protocol"]
  node_rtmfp["RTMFP engine<br/>[RTMFP.cpp]"]
  node_interfaces["Network interfaces<br/>[Interface.cpp]"]
  node_sessions["Sessions<br/>[Session.cpp]"]
  node_packets["Packet assembly"]
end

subgraph group_flows["Flow delivery"]
  node_sendflow["Send flows<br/>[SendFlow.cpp]"]
  node_recvflow["Receive flows<br/>[RecvFlow.cpp]"]
  node_receipts["Write receipts<br/>[WriteReceipt.cpp]"]
  node_sync["Flow synchronization"]
end

subgraph group_media["Tin-Can media"]
  node_tcconnection["Tin-Can connection<br/>[TCConnection.cpp]"]
  node_tcmessage["Tin-Can messages<br/>[TCMessage.cpp]"]
  node_media["Media streams<br/>[Media.cpp]"]
end

subgraph group_integrations["Optional integrations"]
  node_redirector["Redirector client"]
end

node_application(("Host application"))
node_peer(("Remote peer"))
node_network(("Host network"))

node_application -->|"provides adapter"| node_platform
node_application -->|"provides adapter"| node_cryptoapi
node_application -->|"opens flows"| node_rtmfp
node_platform -->|"dispatches packets"| node_rtmfp
node_rtmfp -->|"requests I/O"| node_platform
node_posixadapter -->|"runs on"| node_runloops
node_posixadapter -->|"adapts platform"| node_rtmfp
node_performer -->|"synchronizes tasks"| node_runloops
node_cryptoapi -->|"implemented by"| node_flashcrypto
node_flashcrypto -.->|"primitives from"| node_openssl
node_cryptoapi -->|"implemented by"| node_plaincrypto
node_rtmfp -->|"requests crypto"| node_cryptoapi
node_rtmfp -->|"manages interfaces"| node_interfaces
node_rtmfp -->|"manages sessions"| node_sessions
node_sessions -->|"assembles packets"| node_packets
node_interfaces -->|"sends and receives"| node_network
node_sessions -->|"exchanges packets"| node_peer
node_sessions -->|"binds flows"| node_sendflow
node_sessions -->|"binds flows"| node_recvflow
node_application -->|"writes messages"| node_sendflow
node_sendflow -->|"issues receipts"| node_receipts
node_recvflow -->|"delivers messages"| node_application
node_application -->|"accepts flows"| node_recvflow
node_tcconnection -->|"transports messages"| node_sendflow
node_tcconnection -->|"receives messages"| node_recvflow
node_tcconnection -->|"encodes commands"| node_tcmessage
node_tcconnection -->|"handles streams"| node_media
node_tcconnection -->|"synchronizes flows"| node_sync
node_redirector -->|"opens redirector flow"| node_rtmfp
node_redirector -->|"sends settings"| node_sendflow
node_redirector -->|"reports status"| node_application

click node_platform "https://github.com/zenomt/rtmfp-cpp/blob/main/include/rtmfp/rtmfp.hpp"
click node_posixadapter "https://github.com/zenomt/rtmfp-cpp/blob/main/src/PosixPlatformAdapter.cpp"
click node_runloops "https://github.com/zenomt/rtmfp-cpp/blob/main/include/rtmfp/RunLoops.hpp"
click node_performer "https://github.com/zenomt/rtmfp-cpp/blob/main/src/Performer.cpp"
click node_cryptoapi "https://github.com/zenomt/rtmfp-cpp/blob/main/include/rtmfp/rtmfp.hpp"
click node_flashcrypto "https://github.com/zenomt/rtmfp-cpp/blob/main/src/FlashCryptoAdapter.cpp"
click node_openssl "https://github.com/zenomt/rtmfp-cpp/blob/main/src/FlashCryptoAdapter_OpenSSL.cpp"
click node_plaincrypto "https://github.com/zenomt/rtmfp-cpp/blob/main/src/PlainCryptoAdapter.cpp"
click node_rtmfp "https://github.com/zenomt/rtmfp-cpp/blob/main/src/RTMFP.cpp"
click node_interfaces "https://github.com/zenomt/rtmfp-cpp/blob/main/src/Interface.cpp"
click node_sessions "https://github.com/zenomt/rtmfp-cpp/blob/main/src/Session.cpp"
click node_packets "https://github.com/zenomt/rtmfp-cpp/blob/main/src/PacketAssembler.cpp"
click node_sendflow "https://github.com/zenomt/rtmfp-cpp/blob/main/src/SendFlow.cpp"
click node_recvflow "https://github.com/zenomt/rtmfp-cpp/blob/main/src/RecvFlow.cpp"
click node_receipts "https://github.com/zenomt/rtmfp-cpp/blob/main/src/WriteReceipt.cpp"
click node_sync "https://github.com/zenomt/rtmfp-cpp/blob/main/src/FlowSyncManager.cpp"
click node_tcconnection "https://github.com/zenomt/rtmfp-cpp/blob/main/src/TCConnection.cpp"
click node_tcmessage "https://github.com/zenomt/rtmfp-cpp/blob/main/src/TCMessage.cpp"
click node_media "https://github.com/zenomt/rtmfp-cpp/blob/main/src/Media.cpp"
click node_redirector "https://github.com/zenomt/rtmfp-cpp/blob/main/src/RedirectorClient.cpp"

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_platform,node_posixadapter,node_runloops,node_performer,node_cryptoapi,node_flashcrypto,node_openssl,node_plaincrypto toneBlue
class node_rtmfp,node_interfaces,node_sessions,node_packets toneAmber
class node_sendflow,node_recvflow,node_receipts,node_sync toneMint
class node_tcconnection,node_tcmessage,node_media toneRose
class node_redirector,node_application,node_peer,node_network toneIndigo
```

## Components

### Host integration

- [Platform adapter](https://github.com/zenomt/rtmfp-cpp/blob/main/include/rtmfp/rtmfp.hpp): `include/rtmfp/rtmfp.hpp`
- [POSIX adapters](https://github.com/zenomt/rtmfp-cpp/blob/main/src/PosixPlatformAdapter.cpp): `src/PosixPlatformAdapter.cpp`
- [Run loops](https://github.com/zenomt/rtmfp-cpp/blob/main/include/rtmfp/RunLoops.hpp): `include/rtmfp/RunLoops.hpp`
- [Performer](https://github.com/zenomt/rtmfp-cpp/blob/main/src/Performer.cpp): `src/Performer.cpp`
- [Crypto adapter API](https://github.com/zenomt/rtmfp-cpp/blob/main/include/rtmfp/rtmfp.hpp): `include/rtmfp/rtmfp.hpp`
- [Flash crypto](https://github.com/zenomt/rtmfp-cpp/blob/main/src/FlashCryptoAdapter.cpp): `src/FlashCryptoAdapter.cpp`
- [OpenSSL crypto](https://github.com/zenomt/rtmfp-cpp/blob/main/src/FlashCryptoAdapter_OpenSSL.cpp): `src/FlashCryptoAdapter_OpenSSL.cpp`
- [Plain crypto](https://github.com/zenomt/rtmfp-cpp/blob/main/src/PlainCryptoAdapter.cpp): `src/PlainCryptoAdapter.cpp`

### RTMFP protocol

- [RTMFP engine](https://github.com/zenomt/rtmfp-cpp/blob/main/src/RTMFP.cpp): `src/RTMFP.cpp`
- [Network interfaces](https://github.com/zenomt/rtmfp-cpp/blob/main/src/Interface.cpp): `src/Interface.cpp`
- [Sessions](https://github.com/zenomt/rtmfp-cpp/blob/main/src/Session.cpp): `src/Session.cpp`
- [Packet assembly](https://github.com/zenomt/rtmfp-cpp/blob/main/src/PacketAssembler.cpp): `src/PacketAssembler.cpp`

### Flow delivery

- [Send flows](https://github.com/zenomt/rtmfp-cpp/blob/main/src/SendFlow.cpp): `src/SendFlow.cpp`
- [Receive flows](https://github.com/zenomt/rtmfp-cpp/blob/main/src/RecvFlow.cpp): `src/RecvFlow.cpp`
- [Write receipts](https://github.com/zenomt/rtmfp-cpp/blob/main/src/WriteReceipt.cpp): `src/WriteReceipt.cpp`
- [Flow synchronization](https://github.com/zenomt/rtmfp-cpp/blob/main/src/FlowSyncManager.cpp): `src/FlowSyncManager.cpp`

### Tin-Can media

- [Tin-Can connection](https://github.com/zenomt/rtmfp-cpp/blob/main/src/TCConnection.cpp): `src/TCConnection.cpp`
- [Tin-Can messages](https://github.com/zenomt/rtmfp-cpp/blob/main/src/TCMessage.cpp): `src/TCMessage.cpp`
- [Media streams](https://github.com/zenomt/rtmfp-cpp/blob/main/src/Media.cpp): `src/Media.cpp`

### Optional integrations

- [Redirector client](https://github.com/zenomt/rtmfp-cpp/blob/main/src/RedirectorClient.cpp): `src/RedirectorClient.cpp`

### Other components

- **Host application**
- **Remote peer**
- **Host network**

## Connections

- Host application → Platform adapter: provides adapter
- Host application → Crypto adapter API: provides adapter
- Host application → RTMFP engine: opens flows
- Platform adapter → RTMFP engine: dispatches packets
- RTMFP engine → Platform adapter: requests I/O
- POSIX adapters → Run loops: runs on
- POSIX adapters → RTMFP engine: adapts platform
- Performer → Run loops: synchronizes tasks
- Crypto adapter API → Flash crypto: implemented by
- Flash crypto → OpenSSL crypto: primitives from
- Crypto adapter API → Plain crypto: implemented by
- RTMFP engine → Crypto adapter API: requests crypto
- RTMFP engine → Network interfaces: manages interfaces
- RTMFP engine → Sessions: manages sessions
- Sessions → Packet assembly: assembles packets
- Network interfaces → Host network: sends and receives
- Sessions → Remote peer: exchanges packets
- Sessions → Send flows: binds flows
- Sessions → Receive flows: binds flows
- Host application → Send flows: writes messages
- Send flows → Write receipts: issues receipts
- Receive flows → Host application: delivers messages
- Host application → Receive flows: accepts flows
- Tin-Can connection → Send flows: transports messages
- Tin-Can connection → Receive flows: receives messages
- Tin-Can connection → Tin-Can messages: encodes commands
- Tin-Can connection → Media streams: handles streams
- Tin-Can connection → Flow synchronization: synchronizes flows
- Redirector client → RTMFP engine: opens redirector flow
- Redirector client → Send flows: sends settings
- Redirector client → Host application: reports status
