diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2021-07-30 22:48:47 +0300 |
---|---|---|
committer | Povilas Kanapickas <povilas@radix.lt> | 2021-09-02 19:32:13 +0300 |
commit | c36dde3f4535e948318edc843faeee118492b38e (patch) | |
tree | 76543e344696c6b5996ffa1f227270b46bc94a1a /src/xcb.xsd | |
parent | 78d0652ac33b774c824eaeff82d504e4fe618176 (diff) | |
download | xcb-proto-c36dde3f4535e948318edc843faeee118492b38e.tar.gz |
Add element to specify expression that defines length of a struct
Currently the layout of a struct is used to compute its size. This works
fine in case of structs of fixed size. However this introduces
forwards-compatibility problems in cases when the struct has multiple
variants and the exact variant is specified by the value of some field
(e.g. in the case of <switch> elements). Future revisions of protocols
may introduce new layout variants, in which case the old code does not
know the size of the struct variant and can't parse the incoming byte
stream.
Instead of relying on knowledge about the layout of data structures we
should instead use the length field for length information. This way
when old client libxcb communicates with newer server it can at least
ignore unknown struct variants.
Diffstat (limited to 'src/xcb.xsd')
-rw-r--r-- | src/xcb.xsd | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/xcb.xsd b/src/xcb.xsd index dc3d7cc..86a51c5 100644 --- a/src/xcb.xsd +++ b/src/xcb.xsd @@ -101,6 +101,13 @@ authorization from the authors. <!-- field replaces FIELD, PARAM, and REPLY. --> <xsd:element name="field" type="var" /> + <!-- Length of data structures --> + <xsd:element name="length"> + <xsd:complexType> + <xsd:group ref="expression" /> + </xsd:complexType> + </xsd:element> + <!-- fd passing parameter --> <xsd:element name="fd"> <xsd:complexType> @@ -210,6 +217,7 @@ authorization from the authors. <xsd:element ref="list" /> <xsd:element ref="fd" /> <xsd:element ref="required_start_align" /> + <xsd:element ref="length" /> </xsd:choice> </xsd:group> |