paths: “protocols/**” applyTo: “protocols/**”

Protocol definitions (protocols/)

protocols/<dir>/ holds a protocol's mspec files (src/main/resources/protocols/<dir>/*.mspec), the class that registers them (src/main/java/**/*Protocol.java, getName() is the protocol name, which can differ from the directory: iec-60870 → iec-60870-5-104; one module can register several, ads and ads.discovery), and the shared test suites (src/test/resources/protocols/<dir>/): ParserSerializerTestsuite.xml (bytes ↔ model) and DriverTestsuite.xml (request/response sequences). Syntax: website/asciidoc/modules/developers/pages/code-gen/protocol/mspec.adoc.

⛔ An mspec change reaches every language that generates the protocol

Which languages generate it (Java, Go, C, Python via plc4x-maven-plugin; C# via its own generator):

p=s7   # the name from getName()
grep -rln --include=pom.xml "<protocolName>$p</protocolName>" plc4j plc4go plc4c plc4py | grep -v /target/
grep -n "\"$p\"" plc4net/tools/code-gen/generate_protocol_models.py

For each hit: regenerate (regenerate-code skill) and commit the result with the mspec change. The website matrix (website/asciidoc/modules/users/pages/protocols/index.adoc) says which languages ship a driver; a language can generate a model without shipping a driver, and it still needs the regenerated code.

  • [manual ...] fields and STATIC_CALL("name", ...) call a hand-written helper in every generating language: plc4j/drivers/<p>/**/StaticHelper.java, plc4go/protocols/<p>/readwrite/model/StaticHelper.go, plc4c/drivers/<p>/src/driver_<p>_static.c, plc4py/plc4py/protocols/<p>/StaticHelper.py, plc4net/drivers/<p>/*.Manual.cs. A new or changed call needs the helper in each of them.
  • Renaming a type, field or enum constant renames generated API in every language; the hand-written driver code that uses it changes too. Search each language's driver for the old name.
  • Test suites: a parse or serialize change gets a ParserSerializerTestsuite.xml case. plc4go reads a tracked copy in plc4go/assets/testing/protocols/, refreshed by the Maven build of plc4go (generate-resources): commit the refreshed copy with the change.
  • Vendor data: bacnetip, knxnetip and opcua regenerate part of their mspec from downloaded vendor data (their update-generated-code profile). Do not hand-edit those generated mspec parts.
  • Wire data is untrusted (THREAT-MODEL.md): lengths and counts read from the wire bound arrays and loops; an [assert] or [validation] turns a bad value into a parse error.