Skip to content
mbe24 edited this page Oct 15, 2014 · 3 revisions

First draft

<?xml version="1.0" encoding="UTF-8"?>
<protocol name="alpha">
    <properties>
        <property key="endianness" value="big" />
        <property key="standard.int.length" value="4" />
        <property key="string.encoding" value="UTF-8" />
    </properties>
    <header>
        <bytes hex="DEADBEEF" />
        <total-length value="24" />
    </header>
    <units>
        <unit name="example">
            <structure mode="container">
                <number id="measure" type="int" length="4" />
                <string length="@measure" />
                <string length="4" />
            </structure>
            <structure mode="structure" occurence="@measure">
                <number id="length" type="int" length="2" />
                <string length="@length" />
                <string length="2" />
            </structure>
        </unit>
    </units>
</protocol>

Pitfalls

  • Users need a way to define protocol messages, where primitives like strings and ints are not grouped, i. e. 2 int fields, 1 string, 1 int, 2 strings. Maybe by implementing a common interface, or - the more verbose way - by wrapping them all (as it is done with structure in mode 'container').
  • Provide flexibility in bit-width of integers. Maybe add 1 bit boolean. But minimal width of 4 bits has the advantage that it can directly be translated into 1 hex sign. That way human debugging would be easier. On the other hand, after implementation, unit tests and xsd creation effiency pays off more.

Clone this wiki locally