After a long period of silence, Kaitai project is happy to announce release of new major version of Kaitai Struct, declarative markup language to describe various binary data structures — binary file formats, network stream packets, etc.
The basic idea of Kaitai Struct is that a particular format can be
described using Kaitai Struct language (in a
.ksy file), which then
can be compiled using
kaitai-struct-compiler into source files in
one of the supported programming languages. These modules will include
a generated code for a parser that can read described data structure
from a file / stream and provide access to its contents in a nice,
Also, with this release we’re happy to announce collaboration between Kaitai Struct and Construct, Python declarative parser/builder.
meta/endiancan now contain a switch-like structure (with
cases), akin to switchable types (docs).
type: my_type(arg1, arg2, arg3)to pass arguments into user type (docs).
process: my_process_name(arg1, arg2, arg3)to invoke custom processing routine, implemented in imperative language (docs).
_indexin expressions (docs).
meta/xrefkey can be used for adding cross-references of a format specifications (like relevant RFC entries, Wikidata entries, ISO / IEEE / JIS / DIN / GOST standard numbers, PRONOM identifiers, etc).
KS_STR_ENCODING_NONEto be defined to know how to handle string encodings
KaitaiStreamis now an interface, and there are two distinct classes which implement it:
ByteBufferKaitaiStreamprovides KaitaiStream backed
ByteBuffer(and thus using memory-mapped files)
RandomAccessFileKaitaiStreamprovides KaitaiStream backed by
RandomAccessFile(and thus uses normal OS read calls, as it was done in older KaitaiStruct circa v0.5)
KaitaiStreamand were renamed in the following way:
if-based implementations for languages which do not support switching over all possible types.