# blu-corner/codec architecture

> Architecture diagram of the GitHub repository blu-corner/codec, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/blu-corner/codec
- Repository: https://github.com/blu-corner/codec

## Overview

This is a C++ encode/decode library for exchange order-entry protocols. The principal workflow is: an application obtains a venue codec, supplies a CDR for validated encoding to a wire buffer, then decodes a wire buffer back into a CDR. Fixed-binary packet types offer a lower-level alternative, and Java, C#, and Python bindings expose buffer-based access. The graph preserves documented venue families and substantial protocol branches visible in the tree; relationships for unsampled implementations are omitted unless the README documents them.

Main entry points: [`src/millennium`](https://github.com/blu-corner/codec/tree/master/src/millennium) (Millennium Packets), [`src/bindings/codecBuffer.h`](https://github.com/blu-corner/codec/blob/master/src/bindings/codecBuffer.h) (Binding Buffers), [`src/codec.h`](https://github.com/blu-corner/codec/blob/master/src/codec.h) (Codec Interface), [`src/codecFactory.cpp`](https://github.com/blu-corner/codec/blob/master/src/codecFactory.cpp) (Codec Factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Codec API"]
  node_factory["Codec Factory<br/>[codecFactory.cpp]"]
  node_codec["Codec Interface<br/>[codec.h]"]
end

subgraph group_venues["Venue Codecs"]
  node_fix["FIX Codec<br/>[fixCodec.cpp]"]
  node_lse["LSE Codec<br/>[lseCodec.cpp]"]
  node_oslo["Oslo Codec<br/>[osloCodec.cpp]"]
  node_jse["JSE Codec<br/>[jseCodec.cpp]"]
  node_borsa["Borsa Codec"]
  node_millennium_other["Other Millennium"]
  node_swx["SWX Codec<br/>[swxCodec.cpp]"]
  node_xetra["Xetra Codec<br/>[xetraCodec.cpp]"]
  node_eurex["Eurex Codec<br/>[eurexCodec.cpp]"]
  node_optiq["Optiq Codec<br/>[optiqCodec.cpp]"]
end

subgraph group_protocols["Protocol Packets"]
  node_millennium_packets["Millennium Packets"]
  node_eti_packets["ETI Packets"]
  node_swx_packets["SWX Packets"]
  node_optiq_packets["Optiq Packets"]
end

subgraph group_support["Shared Data Support"]
  node_cdr["CDR Fields<br/>[fields.h]"]
  node_fieldutils["Field Utilities<br/>[fields.cc]"]
  node_helpers["Codec Helpers<br/>[codecHelpers.cpp]"]
end

subgraph group_bindings["Language Bindings"]
  node_binding_buffer["Binding Buffers<br/>[codecBuffer.h]"]
  node_java["Java Binding"]
  node_python["Python Binding"]
  node_csharp["C&#35; Binding"]
end

node_application(("Trading Application"))
node_exchange(("Exchange"))

node_application -->|"requests codec"| node_factory
node_factory -->|"returns codec"| node_codec
node_application -->|"encodes and decodes"| node_codec
node_codec -->|"maps fields"| node_cdr
node_lse -.->|"uses packet types"| node_millennium_packets
node_oslo -.->|"uses packet types"| node_millennium_packets
node_jse -.->|"uses packet types"| node_millennium_packets
node_borsa -.->|"uses packet types"| node_millennium_packets
node_millennium_other -.->|"provides packets"| node_millennium_packets
node_xetra -.->|"uses packet types"| node_eti_packets
node_eurex -.->|"uses packet types"| node_eti_packets
node_swx -->|"uses packet types"| node_swx_packets
node_optiq -->|"uses packet types"| node_optiq_packets
node_application -->|"marshals data"| node_binding_buffer
node_binding_buffer -->|"exposes interface"| node_java
node_binding_buffer -->|"exposes interface"| node_python
node_binding_buffer -->|"exposes interface"| node_csharp
node_codec -->|"formats messages"| node_exchange

click node_factory "https://github.com/blu-corner/codec/blob/master/src/codecFactory.cpp"
click node_codec "https://github.com/blu-corner/codec/blob/master/src/codec.h"
click node_cdr "https://github.com/blu-corner/codec/blob/master/src/fields/fields.h"
click node_fieldutils "https://github.com/blu-corner/codec/blob/master/src/fields/fields.cc"
click node_helpers "https://github.com/blu-corner/codec/blob/master/src/helpers/codecHelpers.cpp"
click node_fix "https://github.com/blu-corner/codec/blob/master/src/fix/fixCodec.cpp"
click node_lse "https://github.com/blu-corner/codec/blob/master/src/millennium/lse/lseCodec.cpp"
click node_oslo "https://github.com/blu-corner/codec/blob/master/src/millennium/oslo/osloCodec.cpp"
click node_jse "https://github.com/blu-corner/codec/blob/master/src/millennium/jse/jseCodec.cpp"
click node_borsa "https://github.com/blu-corner/codec/blob/master/src/millennium/borsa/borsaitalianaCodec.cpp"
click node_millennium_other "https://github.com/blu-corner/codec/tree/master/src/millennium"
click node_swx "https://github.com/blu-corner/codec/blob/master/src/swx/swxCodec.cpp"
click node_xetra "https://github.com/blu-corner/codec/blob/master/src/eti/xetra/xetraCodec.cpp"
click node_eurex "https://github.com/blu-corner/codec/blob/master/src/eti/eurex/eurexCodec.cpp"
click node_optiq "https://github.com/blu-corner/codec/blob/master/src/optiq/optiqCodec.cpp"
click node_millennium_packets "https://github.com/blu-corner/codec/tree/master/src/millennium"
click node_eti_packets "https://github.com/blu-corner/codec/tree/master/src/eti"
click node_swx_packets "https://github.com/blu-corner/codec/tree/master/src/swx/packets"
click node_optiq_packets "https://github.com/blu-corner/codec/tree/master/src/optiq/packets"
click node_binding_buffer "https://github.com/blu-corner/codec/blob/master/src/bindings/codecBuffer.h"
click node_java "https://github.com/blu-corner/codec/tree/master/src/bindings/java"
click node_python "https://github.com/blu-corner/codec/tree/master/src/bindings/python"
click node_csharp "https://github.com/blu-corner/codec/tree/master/src/bindings/csharp"

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_factory,node_codec toneBlue
class node_fix,node_lse,node_oslo,node_jse,node_borsa,node_millennium_other,node_swx,node_xetra,node_eurex,node_optiq toneAmber
class node_millennium_packets,node_eti_packets,node_swx_packets,node_optiq_packets toneMint
class node_cdr,node_fieldutils,node_helpers toneRose
class node_binding_buffer,node_java,node_python,node_csharp,node_application,node_exchange toneIndigo
```

## Components

### Codec API

- [Codec Factory](https://github.com/blu-corner/codec/blob/master/src/codecFactory.cpp): `src/codecFactory.cpp`
- [Codec Interface](https://github.com/blu-corner/codec/blob/master/src/codec.h): `src/codec.h`

### Venue Codecs

- [FIX Codec](https://github.com/blu-corner/codec/blob/master/src/fix/fixCodec.cpp): `src/fix/fixCodec.cpp`
- [LSE Codec](https://github.com/blu-corner/codec/blob/master/src/millennium/lse/lseCodec.cpp): `src/millennium/lse/lseCodec.cpp`
- [Oslo Codec](https://github.com/blu-corner/codec/blob/master/src/millennium/oslo/osloCodec.cpp): `src/millennium/oslo/osloCodec.cpp`
- [JSE Codec](https://github.com/blu-corner/codec/blob/master/src/millennium/jse/jseCodec.cpp): `src/millennium/jse/jseCodec.cpp`
- [Borsa Codec](https://github.com/blu-corner/codec/blob/master/src/millennium/borsa/borsaitalianaCodec.cpp): `src/millennium/borsa/borsaitalianaCodec.cpp`
- [Other Millennium](https://github.com/blu-corner/codec/tree/master/src/millennium): `src/millennium`
- [SWX Codec](https://github.com/blu-corner/codec/blob/master/src/swx/swxCodec.cpp): `src/swx/swxCodec.cpp`
- [Xetra Codec](https://github.com/blu-corner/codec/blob/master/src/eti/xetra/xetraCodec.cpp): `src/eti/xetra/xetraCodec.cpp`
- [Eurex Codec](https://github.com/blu-corner/codec/blob/master/src/eti/eurex/eurexCodec.cpp): `src/eti/eurex/eurexCodec.cpp`
- [Optiq Codec](https://github.com/blu-corner/codec/blob/master/src/optiq/optiqCodec.cpp): `src/optiq/optiqCodec.cpp`

### Protocol Packets

- [Millennium Packets](https://github.com/blu-corner/codec/tree/master/src/millennium): `src/millennium`
- [ETI Packets](https://github.com/blu-corner/codec/tree/master/src/eti): `src/eti`
- [SWX Packets](https://github.com/blu-corner/codec/tree/master/src/swx/packets): `src/swx/packets`
- [Optiq Packets](https://github.com/blu-corner/codec/tree/master/src/optiq/packets): `src/optiq/packets`

### Shared Data Support

- [CDR Fields](https://github.com/blu-corner/codec/blob/master/src/fields/fields.h): `src/fields/fields.h`
- [Field Utilities](https://github.com/blu-corner/codec/blob/master/src/fields/fields.cc): `src/fields/fields.cc`
- [Codec Helpers](https://github.com/blu-corner/codec/blob/master/src/helpers/codecHelpers.cpp): `src/helpers/codecHelpers.cpp`

### Language Bindings

- [Binding Buffers](https://github.com/blu-corner/codec/blob/master/src/bindings/codecBuffer.h): `src/bindings/codecBuffer.h`
- [Java Binding](https://github.com/blu-corner/codec/tree/master/src/bindings/java): `src/bindings/java`
- [Python Binding](https://github.com/blu-corner/codec/tree/master/src/bindings/python): `src/bindings/python`
- [C# Binding](https://github.com/blu-corner/codec/tree/master/src/bindings/csharp): `src/bindings/csharp`

### Other components

- **Trading Application**
- **Exchange**

## Connections

- Trading Application → Codec Factory: requests codec
- Codec Factory → Codec Interface: returns codec
- Trading Application → Codec Interface: encodes and decodes
- Codec Interface → CDR Fields: maps fields (evidence: `src/codec.h`)
- LSE Codec → Millennium Packets: uses packet types (evidence: `src/millennium/lse/lseCodec.cpp`)
- Oslo Codec → Millennium Packets: uses packet types (evidence: `src/millennium/oslo/osloCodec.cpp`)
- JSE Codec → Millennium Packets: uses packet types (evidence: `src/millennium/jse/jseCodec.cpp`)
- Borsa Codec → Millennium Packets: uses packet types (evidence: `src/millennium/borsa/borsaitalianaCodec.cpp`)
- Other Millennium → Millennium Packets: provides packets
- Xetra Codec → ETI Packets: uses packet types
- Eurex Codec → ETI Packets: uses packet types
- SWX Codec → SWX Packets: uses packet types (evidence: `src/swx/swxCodec.cpp`)
- Optiq Codec → Optiq Packets: uses packet types (evidence: `src/optiq/optiqCodec.cpp`)
- Trading Application → Binding Buffers: marshals data
- Binding Buffers → Java Binding: exposes interface
- Binding Buffers → Python Binding: exposes interface
- Binding Buffers → C# Binding: exposes interface
- Codec Interface → Exchange: formats messages
