# openlightingproject/libartnet architecture

> Architecture diagram of the GitHub repository openlightingproject/libartnet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openlightingproject/libartnet
- Repository: https://github.com/openlightingproject/libartnet

## Overview

##### Project type and purpose
- Libartnet is an open-source C library implementing the ArtNet protocol, used to send and receive DMX (lighting control) data over IP networks.
- It exposes a simple C API to user applications, handles packet framing/parsing, and relies on UDP sockets for network I/O.

##### File structure
- Top‐level files:
- configure.ac, Makefile.am, Doxyfile → autotools build and docs
- msvc/... → Visual Studio solution and project files for Windows builds
- debian/... → Debian packaging scripts
- artnet/ directory: the core library sources and headers, organized by functionality:
- artnet.c / artnet.h → public API entry points (init, send, receive)
- network.c → UDP socket creation, send/receive wrappers
- packets.h → ArtNet packet definitions and constants
- transmit.c → DMX packet building for send
- receive.c → packet parsing and dispatch to callbacks
- tod.c → time‐of‐day (TOD) packet handling
- misc.c → utility functions, common.h / misc.h

##### README for additional insights
- Confirms it’s a library, details build instructions for Unix (autotools) and Windows (MSVC).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Runtime Components
    UserApp["User Application"]:::external
    subgraph "libartnet (In-Process Modules)"
        direction TB
        subgraph "Public API"
            APIc["artnet.c"]:::code
            APIh["artnet.h"]:::code
        end
        subgraph "Packet Module"
            Packets["packets.h"]:::code
            Transmit["transmit.c"]:::code
            Receive["receive.c"]:::code
            TODc["tod.c"]:::code
            TODh["tod.h"]:::code
        end
        subgraph "Network Module"
            Network["network.c"]:::code
        end
        subgraph "Utility Module"
            MiscC["misc.c"]:::code
            MiscH["misc.h"]:::code
            CommonH["common.h"]:::code
            PrivateH["private.h"]:::code
        end
    end
    IPNetwork["IP Network (UDP/6454)"]:::external
    DMXDevices["DMX/Lighting Devices"]:::external

    %% Runtime Flow
    UserApp -->|"calls artnet_init()"| APIc
    APIc -->|"uses API definitions"| APIh
    APIc -->|"builds packet"| Transmit
    APIc -->|"parses packet"| Receive
    Transmit -->|"sends raw bytes"| Network
    Network -->|"UDP/6454"| IPNetwork
    IPNetwork -->|"receives raw bytes"| Network
    Network -->|"delivers to parser"| Receive
    Receive -->|"callback with DMX/TOD"| UserApp

    %% Build System
    subgraph "Build System" 
        direction TB
        subgraph "Autotools (Unix)" 
            configure_ac["configure.ac"]:::build
            makefile_am["Makefile.am"]:::build
            config_h_in["config.h.in"]:::build
            artnet_makefile_am["artnet/Makefile.am"]:::build
            pkgconfig["libartnet.pc.in"]:::build
        end
        subgraph "MSVC (Windows)" 
            msvc_sln["msvc/libartnet/libartnet.sln"]:::build
            msvc_vcxproj["msvc/libartnet/libartnet.vcxproj"]:::build
            msvc_filters["msvc/libartnet/libartnet.vcxproj.filters"]:::build
        end
        debian_pkg["debian/*"]:::build
    end

    %% Click Events
    click APIc "https://github.com/openlightingproject/libartnet/blob/master/artnet/artnet.c"
    click APIh "https://github.com/openlightingproject/libartnet/blob/master/artnet/artnet.h"
    click Packets "https://github.com/openlightingproject/libartnet/blob/master/artnet/packets.h"
    click Transmit "https://github.com/openlightingproject/libartnet/blob/master/artnet/transmit.c"
    click Receive "https://github.com/openlightingproject/libartnet/blob/master/artnet/receive.c"
    click TODc "https://github.com/openlightingproject/libartnet/blob/master/artnet/tod.c"
    click TODh "https://github.com/openlightingproject/libartnet/blob/master/artnet/tod.h"
    click Network "https://github.com/openlightingproject/libartnet/blob/master/artnet/network.c"
    click MiscC "https://github.com/openlightingproject/libartnet/blob/master/artnet/misc.c"
    click MiscH "https://github.com/openlightingproject/libartnet/blob/master/artnet/misc.h"
    click CommonH "https://github.com/openlightingproject/libartnet/blob/master/artnet/common.h"
    click PrivateH "https://github.com/openlightingproject/libartnet/blob/master/artnet/private.h"
    click configure_ac "https://github.com/openlightingproject/libartnet/blob/master/configure.ac"
    click makefile_am "https://github.com/openlightingproject/libartnet/blob/master/Makefile.am"
    click config_h_in "https://github.com/openlightingproject/libartnet/blob/master/config.h.in"
    click artnet_makefile_am "https://github.com/openlightingproject/libartnet/blob/master/artnet/Makefile.am"
    click pkgconfig "https://github.com/openlightingproject/libartnet/blob/master/libartnet.pc.in"
    click msvc_sln "https://github.com/openlightingproject/libartnet/blob/master/msvc/libartnet/libartnet.sln"
    click msvc_vcxproj "https://github.com/openlightingproject/libartnet/blob/master/msvc/libartnet/libartnet.vcxproj"
    click msvc_filters "https://github.com/openlightingproject/libartnet/blob/master/msvc/libartnet/libartnet.vcxproj.filters"

    %% Styles
    classDef code fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef external fill:#90EE90,stroke:#000,stroke-width:1px
    classDef build fill:#D3D3D3,stroke:#000,stroke-width:1px
```
