[package]
name = "c-its-parser"
version = "2.0.0"
edition = "2024"
authors = ["consider it GmbH"]
keywords = ["its", "c-its", "v2x", "etsi"]
license = "MIT"
categories = ["no-std", "encoding", "parser-implementations", "wasm"]
description = "Tools for encoding and decoding ETSI messages (GN + Transport + CAM/DENM/IVIM/SSEM/SREM/MAPEM/SPATEM)"
readme = "./README.md"
repository = "https://github.com/consider-it/C-ITS-Parser"
exclude = [
  ".github/*",
  "scripts/*",
  "*.sh",
  "release.md",
  "cliff.toml",
]

[lib]
name = "c_its_parser"
crate-type = ["lib", "cdylib"]

[profile.release]
lto = true

[features]
default = ["v2x", "json", "std"]
# enable all V2X messages
v2x = ["cpm_1", "denm_1_3_1", "ivim_2_1_1", "cam_1_4_1", "cpm_2_1_1", "denm_2_2_1", "ivim_2_2_1", "mapem_2_2_1", "spatem_2_2_1", "srem_2_2_1", "ssem_2_2_1"]
# enable GN (and other transport header) parser
transport = ["dep:geonetworking", "dep:nom", "dep:etherparse"]
# enable conversions to and from JSON
json = ["geonetworking/json", "dep:serde", "dep:serde_json", "dep:js-sys"]
# enable conversions to geo-types
geo = ["dep:geo-types"]
# enable conversions of time types
time = ["dep:chrono"]
# Enable using the libstd runtime
std = []

# enable support for `cpm_1`. Note: wasm shall only be used with all messages enabled (`v2x` feature flag)!
cpm_1         = ["_etsi", "cam_1_4_1", "_cdd_1_3_1_1", "_dsrc_2_2_1"]
# enable support for `denm_1_3_1`. Note: wasm shall only be used with all messages enabled (`v2x` feature flag)!
denm_1_3_1    = ["_etsi", "_cdd_1_3_1_1"]
# enable support for `ivim_2_1_1`. Note: wasm shall only be used with all messages enabled (`v2x` feature flag)!
ivim_2_1_1    = ["_etsi", "_cdd_1_3_1_1", "_dsrc_2_2_1"]
# enable support for `cam_1_4_1`. Note: wasm shall only be used with all messages enabled (`v2x` feature flag)!
cam_1_4_1     = ["_etsi", "_cdd_1_3_1_1"]
# enable support for `cpm_2_1_1`. Note: wasm shall only be used with all messages enabled (`v2x` feature flag)!
cpm_2_1_1     = ["_etsi", "_cdd_2_2_1"]
# enable support for `denm_2_2_1`. Note: wasm shall only be used with all messages enabled (`v2x` feature flag)!
denm_2_2_1    = ["_etsi", "_cdd_2_2_1"]
# enable support for `ivim_2_2_1`. Note: wasm shall only be used with all messages enabled (`v2x` feature flag)!
ivim_2_2_1    = ["_etsi", "_cdd_2_2_1", "_dsrc_2_2_1"]
# enable support for `mapem_2_2_1`. Note: wasm shall only be used with all messages enabled (`v2x` feature flag)!
mapem_2_2_1   = ["_etsi", "_cdd_2_2_1", "_dsrc_2_2_1"]
# enable support for `spatem_2_2_1`. Note: wasm shall only be used with all messages enabled (`v2x` feature flag)!
spatem_2_2_1  = ["_etsi", "_cdd_2_2_1", "_dsrc_2_2_1"]
# enable support for `srem_2_2_1`. Note: wasm shall only be used with all messages enabled (`v2x` feature flag)!
srem_2_2_1    = ["_etsi", "_cdd_2_2_1", "_dsrc_2_2_1"]
# enable support for `ssem_2_2_1`. Note: wasm shall only be used with all messages enabled (`v2x` feature flag)!
ssem_2_2_1    = ["_etsi", "_cdd_2_2_1", "_dsrc_2_2_1"]

# shortcut for `cpm_1` and `cpm_2_1_1`
cpm     = ["cpm_1", "cpm_2_1_1"]
# synonym for `cam_1_4_1`
cam     = ["cam_1_4_1"]
# shortcut for `ivim_2_1_1` and `ivim_2_2_1`
ivim    = ["ivim_2_1_1", "ivim_2_2_1"]
# shortcut for `denm_1_3_1` and `denm_2_2_1`
denm    = ["denm_1_3_1", "denm_2_2_1"]
# synonym for `mapem_2_2_1`
mapem   = ["mapem_2_2_1"]
# synonym for `spatem_2_2_1`
spatem  = ["spatem_2_2_1"]
# synonym for `srem_2_2_1`
srem    = ["srem_2_2_1"]
# synonym for `ssem_2_2_1`
ssem    = ["ssem_2_2_1"]

# internal feature enabling the CDD 1.3.1-1
_cdd_1_3_1_1  = []
# internal feature enabling the CDD 2.2.1
_cdd_2_2_1    = []
# internal feature enabling the DSRC 2.2.1
_dsrc_2_2_1   = []
# internal feature enabling common ETSI ASN.1 data types and the ASN.1 parser itself
_etsi = ["transport", "dep:nom", "rasn", "dep:hex"]

[dependencies]
chrono = { version = "0.4.42", default-features = false, optional = true }
etherparse = { version = "0.20", default-features = false, optional = true }
geonetworking = { version = "0.2", default-features = false, optional = true }
geo-types = { version = "0.7.17", default-features = false, optional = true }
nom = { version = "7.1.3", default-features = false, features = ["alloc"], optional = true }
rasn = { version = "0.28.7", optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
serde_json = { version = "1.0", default-features = false, features = ["alloc"], optional = true }

[target.wasm32-unknown-unknown.dependencies]
hex = { version = "0.4", optional = true }
js-sys = { version = "0.3.79", optional = true }
wasm-bindgen = { version = "0.2.102" }

[dev-dependencies]
pretty_assertions = "1.4.1"
assert_float_eq = "1.2.0"
wasm-bindgen-test = "0.3.52"
xmltree = "0.12.0"
