CommsDSL Specification
  • Introduction
  • Version
  • Schema Definition
  • Multiple Files
  • Namespaces
  • Platforms
  • References
  • Properties
  • Numeric Values
  • Boolean Values
  • Names
  • Protocol Versioning
  • Schema
  • Fields
    • Common Properties of Fields
    • enum Field
    • int Field
    • set Field
    • bitfield Field
    • bundle Field
    • string Field
    • data Field
    • list Field
    • float Field
    • ref Field
    • optional Field
    • variant Field
    • Referencing Values of Other Fields
  • Messages
  • Interfaces
  • Aliases
  • Frames
    • Common Properties of Layers
    • payload Layer
    • id Layer
    • size Layer
    • sync Layer
    • checksum Layer
    • value Layer
    • custom Layer
  • Protocol Versioning Summary
  • Appendix
    • Properties of schema
    • Common Properties of Fields
    • Properties of enum Field
    • Properties of int Field
    • Properties of set Field
    • Properties of bitfield Field
    • Properties of bundle Field
    • Properties of string Field
    • Properties of data Field
    • Properties of list Field
    • Properties of float Field
    • Properties of ref Field
    • Properties of optional Field
    • Properties of variant Field
    • Units
    • Properties of message
    • Properties of interface
    • Properties of alias
    • Properties of frame
    • Common Properties of Layers
    • Properties of checksum Layer
    • Properties of value Layer
    • Properties of custom Layer
Powered by GitBook
On this page
  • Version of the Schema
  • Version in the Interface
  • Version in the Frame
  • Version of the Fields and Messages
  • Version Dependency of the Code
  • Compatibility Recommendation

Was this helpful?

Protocol Versioning Summary

Previouscustom LayerNextAppendix

Last updated 5 years ago

Was this helpful?

This chapter summarizes all version related aspects of the protocol definition.

Version of the Schema

The protocol definition has the version , that specifies numeric version of the protocol.

<?xml version="1.0" encoding="UTF-8"?>
<schema name="MyProtocol" version="5">
    ...
</schema>

Version in the Interface

If protocol reports its version via transport or via some special "connection" , and the protocol version must influence how some messages are deserialized / handled, then there is a need for definition, which must contain version field, marked as such using semanticType="version" property.

<?xml version="1.0" encoding="UTF-8"?>
<schema name="MyProtocol" version="5">
    <interface name="Interface">
        <int field="SomeName" type="uint16" semanticType="version" /> 
    </interface>
    ...
</schema>

Version in the Frame

<?xml version="1.0" encoding="UTF-8"?>
<schema name="MyProtocol" version="5">
    <interface name="Interface">
        <int field="SomeName" type="uint16" semanticType="version" /> 
    </interface>

    <frame name="Frame">
        <size name="Size">
            <int name="SizeField" type="uint16" serOffset="2"/>
        </size>
        <id name="Id">
            <int name="IdField" type="uint8" />  
        </id>
        <value name="Version" interfaces="Interface" interfaceFieldName="SomeName">
            <int name="VersionField" type="uint16" /> 
        </value>
        <payload name="Data" />
    </frame>
</schema>

Version of the Fields and Messages

  • sinceVersion - Version when the message / field has been introduced.

  • deprecated - Version when the message / field has been deprecated.

  • removed - Indication that deprecated message / field must be removed from

    serialization and code generation.

Version Dependency of the Code

If none of the interfaces has such field, then the generated code cannot be version dependent and all the version related properties become for documentation purposes only and cannot influence the presence of the messages / fields. In such cases the code generator is expected to receive required protocol version in its command line parameters and generate code for requested protocol version.

Compatibility Recommendation

In case CommsDSL is used to define new protocol developed from scratch and backward / forward compatibility of the protocol is a desired feature, then there are few simple rules below, following of which can insure such compatibility.

  • message that is sent to establish connection and report protocol version

  • version using sinceVersion property.

  • Add element serialization length report before every

    elemLengthPrefix property).

  • redundant report of the same element length before every element), never

In addition to the containing version information, the transport is also expected to contain layer, which will reassign the received version information to the message object (via ).

Every and support the following properties, wich can be used to supply version related information.

The generated code is expected to be version dependent (i.e. presence of some messages / fields is determined by the reported version value), if at least one of the defined -es contains version field (marked by semanticType="version").

Use layer in the transport

to report remaining length of the message.

Use layer to report protocol version

in the transport or define special "connect"

(mark the layer to be pseudo).

Always add new at the end of the

. Don't forget to specify their

Don't remove deprecated .

Always add new at the bottom of the

element.

element of the field (done using

In case elemFixedLength is

assigned for the (to avoid

add variable length to the element of the list.

<schema>
property
framing
message
<interface>
<interface>
<frame>
<value>
<interface>
message
field
<interface>
<size>
framing
<value>
framing
<value>
fields
<message>
fields
fields
<list>
<list>
property
<list>
fields