# martin-p/openv2g architecture

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

- Interactive diagram: https://gitdiagram.com/martin-p/openv2g
- Repository: https://github.com/martin-p/openv2g

## Overview

OpenV2G is a C implementation of basic ISO/IEC 15118 vehicle-to-grid communication, with EXI serialization support for application-handshake messages, DIN 70121, ISO 15118-2:2013 and :2016, and optional XML signature data. The principal represented workflow is encoding or decoding schema-shaped messages through EXI channels; the README also identifies V2GTP transport support. The excerpts and index establish some generated-code dependencies, but do not show a complete application-level session flow or all schema codecs, so those links are not inferred.

Main entry points: [`src/codec/EncoderChannel.c`](https://github.com/martin-p/openv2g/blob/master/src/codec/EncoderChannel.c) (Encoder channel), [`src/appHandshake/appHandEXIDatatypesEncoder.c`](https://github.com/martin-p/openv2g/blob/master/src/appHandshake/appHandEXIDatatypesEncoder.c) (Handshake encoder), [`src/appHandshake/appHandEXIDatatypesDecoder.c`](https://github.com/martin-p/openv2g/blob/master/src/appHandshake/appHandEXIDatatypesDecoder.c) (Handshake decoder), [`src/codec/DecoderChannel.c`](https://github.com/martin-p/openv2g/blob/master/src/codec/DecoderChannel.c) (Decoder channel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_schemas["Protocol schemas"]
  node_handshake_types["Handshake types"]
  node_handshake_encoder["Handshake encoder"]
  node_handshake_decoder["Handshake decoder"]
  node_din_types["DIN types<br/>[dinEXIDatatypes.h]"]
  node_din_encoder["DIN encoder"]
  node_iso1_types["ISO1 types<br/>[iso1EXIDatatypes.h]"]
  node_iso2_types["ISO2 types<br/>[iso2EXIDatatypes.h]"]
  node_signature_types["Signature types"]
  node_signature_encoder["Signature encoder"]
  node_signature_decoder["Signature decoder"]
end

subgraph group_serialization["EXI serialization"]
  node_encoder_channel["Encoder channel<br/>[EncoderChannel.c]"]
  node_decoder_channel["Decoder channel<br/>[DecoderChannel.c]"]
  node_header_encoder["EXI header encoder<br/>[EXIHeaderEncoder.c]"]
  node_header_decoder["EXI header decoder<br/>[EXIHeaderDecoder.c]"]
  node_bit_output["Bit output<br/>[BitOutputStream.c]"]
  node_bit_input["Bit input<br/>[BitInputStream.c]"]
  node_codec_support["Codec support"]
end

subgraph group_transport["V2G transport"]
  node_v2gtp["V2GTP framing<br/>[v2gtp.c]"]
end

node_developer(("V2G peer"))

node_handshake_encoder -->|"encodes through"| node_encoder_channel
node_handshake_encoder -->|"uses header"| node_header_encoder
node_handshake_decoder -->|"decodes through"| node_decoder_channel
node_handshake_decoder -->|"uses header"| node_header_decoder
node_din_encoder -->|"encodes through"| node_encoder_channel
node_din_encoder -->|"uses header"| node_header_encoder
node_signature_encoder -->|"encodes through"| node_encoder_channel
node_signature_encoder -->|"uses header"| node_header_encoder
node_signature_decoder -->|"decodes through"| node_decoder_channel
node_signature_decoder -->|"uses header"| node_header_decoder
node_encoder_channel -->|"writes bits"| node_bit_output
node_decoder_channel -->|"reads bits"| node_bit_input
node_developer -.->|"provides messages"| node_handshake_encoder
node_developer -.->|"receives messages"| node_handshake_decoder

click node_handshake_types "https://github.com/martin-p/openv2g/blob/master/src/appHandshake/appHandEXIDatatypes.h"
click node_handshake_encoder "https://github.com/martin-p/openv2g/blob/master/src/appHandshake/appHandEXIDatatypesEncoder.c"
click node_handshake_decoder "https://github.com/martin-p/openv2g/blob/master/src/appHandshake/appHandEXIDatatypesDecoder.c"
click node_din_types "https://github.com/martin-p/openv2g/blob/master/src/din/dinEXIDatatypes.h"
click node_din_encoder "https://github.com/martin-p/openv2g/blob/master/src/din/dinEXIDatatypesEncoder.c"
click node_iso1_types "https://github.com/martin-p/openv2g/blob/master/src/iso1/iso1EXIDatatypes.h"
click node_iso2_types "https://github.com/martin-p/openv2g/blob/master/src/iso2/iso2EXIDatatypes.h"
click node_signature_types "https://github.com/martin-p/openv2g/blob/master/src/xmldsig/xmldsigEXIDatatypes.h"
click node_signature_encoder "https://github.com/martin-p/openv2g/blob/master/src/xmldsig/xmldsigEXIDatatypesEncoder.c"
click node_signature_decoder "https://github.com/martin-p/openv2g/blob/master/src/xmldsig/xmldsigEXIDatatypesDecoder.c"
click node_encoder_channel "https://github.com/martin-p/openv2g/blob/master/src/codec/EncoderChannel.c"
click node_decoder_channel "https://github.com/martin-p/openv2g/blob/master/src/codec/DecoderChannel.c"
click node_header_encoder "https://github.com/martin-p/openv2g/blob/master/src/codec/EXIHeaderEncoder.c"
click node_header_decoder "https://github.com/martin-p/openv2g/blob/master/src/codec/EXIHeaderDecoder.c"
click node_bit_output "https://github.com/martin-p/openv2g/blob/master/src/codec/BitOutputStream.c"
click node_bit_input "https://github.com/martin-p/openv2g/blob/master/src/codec/BitInputStream.c"
click node_codec_support "https://github.com/martin-p/openv2g/tree/master/src/codec"
click node_v2gtp "https://github.com/martin-p/openv2g/blob/master/src/transport/v2gtp.c"

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_handshake_types,node_handshake_encoder,node_handshake_decoder,node_din_types,node_din_encoder,node_iso1_types,node_iso2_types,node_signature_types,node_signature_encoder,node_signature_decoder toneBlue
class node_encoder_channel,node_decoder_channel,node_header_encoder,node_header_decoder,node_bit_output,node_bit_input,node_codec_support toneAmber
class node_v2gtp toneMint
class node_developer toneIndigo
```

## Components

### Protocol schemas

- [Handshake types](https://github.com/martin-p/openv2g/blob/master/src/appHandshake/appHandEXIDatatypes.h): `src/appHandshake/appHandEXIDatatypes.h`
- [Handshake encoder](https://github.com/martin-p/openv2g/blob/master/src/appHandshake/appHandEXIDatatypesEncoder.c): `src/appHandshake/appHandEXIDatatypesEncoder.c`
- [Handshake decoder](https://github.com/martin-p/openv2g/blob/master/src/appHandshake/appHandEXIDatatypesDecoder.c): `src/appHandshake/appHandEXIDatatypesDecoder.c`
- [DIN types](https://github.com/martin-p/openv2g/blob/master/src/din/dinEXIDatatypes.h): `src/din/dinEXIDatatypes.h`
- [DIN encoder](https://github.com/martin-p/openv2g/blob/master/src/din/dinEXIDatatypesEncoder.c): `src/din/dinEXIDatatypesEncoder.c`
- [ISO1 types](https://github.com/martin-p/openv2g/blob/master/src/iso1/iso1EXIDatatypes.h): `src/iso1/iso1EXIDatatypes.h`
- [ISO2 types](https://github.com/martin-p/openv2g/blob/master/src/iso2/iso2EXIDatatypes.h): `src/iso2/iso2EXIDatatypes.h`
- [Signature types](https://github.com/martin-p/openv2g/blob/master/src/xmldsig/xmldsigEXIDatatypes.h): `src/xmldsig/xmldsigEXIDatatypes.h`
- [Signature encoder](https://github.com/martin-p/openv2g/blob/master/src/xmldsig/xmldsigEXIDatatypesEncoder.c): `src/xmldsig/xmldsigEXIDatatypesEncoder.c`
- [Signature decoder](https://github.com/martin-p/openv2g/blob/master/src/xmldsig/xmldsigEXIDatatypesDecoder.c): `src/xmldsig/xmldsigEXIDatatypesDecoder.c`

### EXI serialization

- [Encoder channel](https://github.com/martin-p/openv2g/blob/master/src/codec/EncoderChannel.c): `src/codec/EncoderChannel.c`
- [Decoder channel](https://github.com/martin-p/openv2g/blob/master/src/codec/DecoderChannel.c): `src/codec/DecoderChannel.c`
- [EXI header encoder](https://github.com/martin-p/openv2g/blob/master/src/codec/EXIHeaderEncoder.c): `src/codec/EXIHeaderEncoder.c`
- [EXI header decoder](https://github.com/martin-p/openv2g/blob/master/src/codec/EXIHeaderDecoder.c): `src/codec/EXIHeaderDecoder.c`
- [Bit output](https://github.com/martin-p/openv2g/blob/master/src/codec/BitOutputStream.c): `src/codec/BitOutputStream.c`
- [Bit input](https://github.com/martin-p/openv2g/blob/master/src/codec/BitInputStream.c): `src/codec/BitInputStream.c`
- [Codec support](https://github.com/martin-p/openv2g/tree/master/src/codec): `src/codec`

### V2G transport

- [V2GTP framing](https://github.com/martin-p/openv2g/blob/master/src/transport/v2gtp.c): `src/transport/v2gtp.c`

### Other components

- **V2G peer**

## Connections

- Handshake encoder → Encoder channel: encodes through (evidence: `src/appHandshake/appHandEXIDatatypesEncoder.c`)
- Handshake encoder → EXI header encoder: uses header (evidence: `src/appHandshake/appHandEXIDatatypesEncoder.c`)
- Handshake decoder → Decoder channel: decodes through (evidence: `src/appHandshake/appHandEXIDatatypesDecoder.c`)
- Handshake decoder → EXI header decoder: uses header (evidence: `src/appHandshake/appHandEXIDatatypesDecoder.c`)
- DIN encoder → Encoder channel: encodes through (evidence: `src/din/dinEXIDatatypesEncoder.c`)
- DIN encoder → EXI header encoder: uses header (evidence: `src/din/dinEXIDatatypesEncoder.c`)
- Signature encoder → Encoder channel: encodes through (evidence: `src/xmldsig/xmldsigEXIDatatypesEncoder.c`)
- Signature encoder → EXI header encoder: uses header (evidence: `src/xmldsig/xmldsigEXIDatatypesEncoder.c`)
- Signature decoder → Decoder channel: decodes through (evidence: `src/xmldsig/xmldsigEXIDatatypesDecoder.c`)
- Signature decoder → EXI header decoder: uses header (evidence: `src/xmldsig/xmldsigEXIDatatypesDecoder.c`)
- Encoder channel → Bit output: writes bits (evidence: `src/codec/EncoderChannel.c`)
- Decoder channel → Bit input: reads bits (evidence: `src/codec/DecoderChannel.c`)
- V2G peer → Handshake encoder: provides messages
- V2G peer → Handshake decoder: receives messages
