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