]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/file/magic/Magdir/sereal
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / file / magic / Magdir / sereal
1
2 #------------------------------------------------------------------------------
3 # $File: sereal,v 1.3 2015/02/05 19:14:45 christos Exp $
4 # sereal: file(1) magic the Sereal binary serialization format
5 #
6 # From: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
7 #
8 # See the specification of the format at
9 # https://github.com/Sereal/Sereal/blob/master/sereal_spec.pod#document-header-format
10 #
11 # I'd have liked to do the byte&0xF0 matching against 0, 1, 2 ... by
12 # doing (byte&0xF0)>>4 here, but unfortunately that's not
13 # supported. So when we print out a message about an unknown format
14 # we'll print out e.g. 0x30 instead of the more human-readable
15 # 0x30>>4.
16 #
17 # See https://github.com/Sereal/Sereal/commit/35372ae01d in the
18 # Sereal.git repository for test Sereal data.
19 0       name            sereal
20 >4      byte&0x0F       x               (version %d,
21 >4      byte&0xF0       0x00            uncompressed)
22 >4      byte&0xF0       0x10            compressed with non-incremental Snappy)
23 >4      byte&0xF0       0x20            compressed with incremental Snappy)
24 >4      byte&0xF0       >0x20           unknown subformat, flag: %d>>4)
25
26 0       string/b        \=srl           Sereal data packet
27 !:mime application/sereal
28 >&0     use             sereal
29 0       string/b        \=\xF3rl        Sereal data packet
30 !:mime application/sereal
31 >&0     use             sereal
32 0       string/b        \=\xC3\xB3rl    Sereal data packet, UTF-8 encoded
33 !:mime application/sereal
34 >&0     use             sereal
35