language = "C"
pragma_once = true
include_guard = "PUNKTFUNK_CORE_H"
autogen_warning = "/* Generated by cbindgen from punktfunk-core. Do not edit by hand. */"
header = "/* punktfunk-core C ABI — see crates/punktfunk-core/src/abi.rs */"
style = "type"
cpp_compat = true
tab_width = 4
documentation = true
documentation_style = "c99"

[parse]
parse_deps = false

[export]
# Internal platform-only FFI — NOT part of the C ABI. cbindgen otherwise sweeps the foreign
# imports and their #[repr(C)] structs into the header, where socklen_t/ssize_t/iovec/msghdr are
# undefined and the C harness fails to compile: the Apple batched recv (transport/udp.rs
# `recvmsg_x` + `MsghdrX`) and the Android bionic mmsg bindings (`android_mmsg` module).
exclude = ["MsghdrX", "recvmsg_x", "mmsghdr", "sendmmsg", "recvmmsg"]

[export.rename]
"InputEvent" = "PunktfunkInputEvent"
"InputKind" = "PunktfunkInputKind"
# Gamepad wire constants: bare BTN_* names collide with <linux/input-event-codes.h> (at
# DIFFERENT values — last definition silently wins); prefix everything we export.
"BTN_DPAD_UP" = "PUNKTFUNK_BTN_DPAD_UP"
"BTN_DPAD_DOWN" = "PUNKTFUNK_BTN_DPAD_DOWN"
"BTN_DPAD_LEFT" = "PUNKTFUNK_BTN_DPAD_LEFT"
"BTN_DPAD_RIGHT" = "PUNKTFUNK_BTN_DPAD_RIGHT"
"BTN_START" = "PUNKTFUNK_BTN_START"
"BTN_BACK" = "PUNKTFUNK_BTN_BACK"
"BTN_LS_CLICK" = "PUNKTFUNK_BTN_LS_CLICK"
"BTN_RS_CLICK" = "PUNKTFUNK_BTN_RS_CLICK"
"BTN_LB" = "PUNKTFUNK_BTN_LB"
"BTN_RB" = "PUNKTFUNK_BTN_RB"
"BTN_GUIDE" = "PUNKTFUNK_BTN_GUIDE"
"BTN_A" = "PUNKTFUNK_BTN_A"
"BTN_B" = "PUNKTFUNK_BTN_B"
"BTN_X" = "PUNKTFUNK_BTN_X"
"BTN_Y" = "PUNKTFUNK_BTN_Y"
"BTN_TOUCHPAD" = "PUNKTFUNK_BTN_TOUCHPAD"
"AXIS_LS_X" = "PUNKTFUNK_AXIS_LS_X"
"AXIS_LS_Y" = "PUNKTFUNK_AXIS_LS_Y"
"AXIS_RS_X" = "PUNKTFUNK_AXIS_RS_X"
"AXIS_RS_Y" = "PUNKTFUNK_AXIS_RS_Y"
"AXIS_LT" = "PUNKTFUNK_AXIS_LT"
"AXIS_RT" = "PUNKTFUNK_AXIS_RT"
"AUDIO_MAGIC" = "PUNKTFUNK_AUDIO_MAGIC"
"RUMBLE_MAGIC" = "PUNKTFUNK_RUMBLE_MAGIC"

# QualifiedScreamingSnakeCase already qualifies each variant with the enum name
# (PunktfunkStatus::Ok -> PUNKTFUNK_STATUS_OK); do NOT also set prefix_with_name or it doubles.
[enum]
rename_variants = "QualifiedScreamingSnakeCase"

[fn]
sort_by = "None"

[struct]
derive_eq = false

[defines]
"feature = quic" = "PUNKTFUNK_FEATURE_QUIC"
