1.1.20
by Alexandre Mestiashvili
Import upstream version 3.005.001 |
1 |
#ifndef SEEN_SRL_PROTOCOL_H_
|
2 |
#define SEEN_SRL_PROTOCOL_H_
|
|
1
by Alexandre Mestiashvili
Import upstream version 0.31 |
3 |
|
4 |
/*
|
|
5 |
=for autoupdater start
|
|
6 |
||
7 |
||
8 |
Tag | Char | Dec | Hex | Binary | Follow
|
|
9 |
------------------+------+-----+------+----------- |-----------------------------------------
|
|
10 |
POS_0 | | 0 | 0x00 | 0b00000000 | small positive integer - value in low 4 bits (identity)
|
|
11 |
POS_1 | | 1 | 0x01 | 0b00000001 |
|
|
12 |
POS_2 | | 2 | 0x02 | 0b00000010 |
|
|
13 |
POS_3 | | 3 | 0x03 | 0b00000011 |
|
|
14 |
POS_4 | | 4 | 0x04 | 0b00000100 |
|
|
15 |
POS_5 | | 5 | 0x05 | 0b00000101 |
|
|
16 |
POS_6 | | 6 | 0x06 | 0b00000110 |
|
|
17 |
POS_7 | "\a" | 7 | 0x07 | 0b00000111 |
|
|
18 |
POS_8 | "\b" | 8 | 0x08 | 0b00001000 |
|
|
19 |
POS_9 | "\t" | 9 | 0x09 | 0b00001001 |
|
|
20 |
POS_10 | "\n" | 10 | 0x0a | 0b00001010 |
|
|
21 |
POS_11 | | 11 | 0x0b | 0b00001011 |
|
|
22 |
POS_12 | "\f" | 12 | 0x0c | 0b00001100 |
|
|
23 |
POS_13 | "\r" | 13 | 0x0d | 0b00001101 |
|
|
24 |
POS_14 | | 14 | 0x0e | 0b00001110 |
|
|
25 |
POS_15 | | 15 | 0x0f | 0b00001111 | small positive integer - value in low 4 bits (identity)
|
|
26 |
NEG_16 | | 16 | 0x10 | 0b00010000 | small negative integer - value in low 4 bits (k+32)
|
|
27 |
NEG_15 | | 17 | 0x11 | 0b00010001 |
|
|
28 |
NEG_14 | | 18 | 0x12 | 0b00010010 |
|
|
29 |
NEG_13 | | 19 | 0x13 | 0b00010011 |
|
|
30 |
NEG_12 | | 20 | 0x14 | 0b00010100 |
|
|
31 |
NEG_11 | | 21 | 0x15 | 0b00010101 |
|
|
32 |
NEG_10 | | 22 | 0x16 | 0b00010110 |
|
|
33 |
NEG_9 | | 23 | 0x17 | 0b00010111 |
|
|
34 |
NEG_8 | | 24 | 0x18 | 0b00011000 |
|
|
35 |
NEG_7 | | 25 | 0x19 | 0b00011001 |
|
|
36 |
NEG_6 | | 26 | 0x1a | 0b00011010 |
|
|
37 |
NEG_5 | "\e" | 27 | 0x1b | 0b00011011 |
|
|
38 |
NEG_4 | | 28 | 0x1c | 0b00011100 |
|
|
39 |
NEG_3 | | 29 | 0x1d | 0b00011101 |
|
|
40 |
NEG_2 | | 30 | 0x1e | 0b00011110 |
|
|
41 |
NEG_1 | | 31 | 0x1f | 0b00011111 | small negative integer - value in low 4 bits (k+32)
|
|
42 |
VARINT | " " | 32 | 0x20 | 0b00100000 | <VARINT> - Varint variable length integer
|
|
43 |
ZIGZAG | "!" | 33 | 0x21 | 0b00100001 | <ZIGZAG-VARINT> - Zigzag variable length integer
|
|
44 |
FLOAT | "\"" | 34 | 0x22 | 0b00100010 | <IEEE-FLOAT>
|
|
45 |
DOUBLE | "#" | 35 | 0x23 | 0b00100011 | <IEEE-DOUBLE>
|
|
46 |
LONG_DOUBLE | "\$" | 36 | 0x24 | 0b00100100 | <IEEE-LONG-DOUBLE>
|
|
1.1.9
by gregor herrmann
Import upstream version 3.001 |
47 |
UNDEF | "%" | 37 | 0x25 | 0b00100101 | None - Perl undef var; eg my $var= undef;
|
1
by Alexandre Mestiashvili
Import upstream version 0.31 |
48 |
BINARY | "&" | 38 | 0x26 | 0b00100110 | <LEN-VARINT> <BYTES> - binary/(latin1) string
|
49 |
STR_UTF8 | "'" | 39 | 0x27 | 0b00100111 | <LEN-VARINT> <UTF8> - utf8 string
|
|
50 |
REFN | "(" | 40 | 0x28 | 0b00101000 | <ITEM-TAG> - ref to next item
|
|
51 |
REFP | ")" | 41 | 0x29 | 0b00101001 | <OFFSET-VARINT> - ref to previous item stored at offset
|
|
52 |
HASH | "*" | 42 | 0x2a | 0b00101010 | <COUNT-VARINT> [<KEY-TAG> <ITEM-TAG> ...] - count followed by key/value pairs
|
|
53 |
ARRAY | "+" | 43 | 0x2b | 0b00101011 | <COUNT-VARINT> [<ITEM-TAG> ...] - count followed by items
|
|
54 |
OBJECT | "," | 44 | 0x2c | 0b00101100 | <STR-TAG> <ITEM-TAG> - class, object-item
|
|
55 |
OBJECTV | "-" | 45 | 0x2d | 0b00101101 | <OFFSET-VARINT> <ITEM-TAG> - offset of previously used classname tag - object-item
|
|
56 |
ALIAS | "." | 46 | 0x2e | 0b00101110 | <OFFSET-VARINT> - alias to item defined at offset
|
|
57 |
COPY | "/" | 47 | 0x2f | 0b00101111 | <OFFSET-VARINT> - copy of item defined at offset
|
|
58 |
WEAKEN | "0" | 48 | 0x30 | 0b00110000 | <REF-TAG> - Weaken the following reference
|
|
59 |
REGEXP | "1" | 49 | 0x31 | 0b00110001 | <PATTERN-STR-TAG> <MODIFIERS-STR-TAG>
|
|
1.1.3
by Alexandre Mestiashvili
Import upstream version 2.03 |
60 |
OBJECT_FREEZE | "2" | 50 | 0x32 | 0b00110010 | <STR-TAG> <ITEM-TAG> - class, object-item. Need to call "THAW" method on class after decoding
|
61 |
OBJECTV_FREEZE | "3" | 51 | 0x33 | 0b00110011 | <OFFSET-VARINT> <ITEM-TAG> - (OBJECTV_FREEZE is to OBJECT_FREEZE as OBJECTV is to OBJECT)
|
|
62 |
RESERVED_0 | "4" | 52 | 0x34 | 0b00110100 | reserved
|
|
63 |
RESERVED_1 | "5" | 53 | 0x35 | 0b00110101 |
|
|
64 |
RESERVED_2 | "6" | 54 | 0x36 | 0b00110110 |
|
|
65 |
RESERVED_3 | "7" | 55 | 0x37 | 0b00110111 |
|
|
1.1.9
by gregor herrmann
Import upstream version 3.001 |
66 |
RESERVED_4 | "8" | 56 | 0x38 | 0b00111000 | reserved
|
67 |
CANONICAL_UNDEF | "9" | 57 | 0x39 | 0b00111001 | undef (PL_sv_undef) - "the" Perl undef (see notes)
|
|
1
by Alexandre Mestiashvili
Import upstream version 0.31 |
68 |
FALSE | ":" | 58 | 0x3a | 0b00111010 | false (PL_sv_no)
|
69 |
TRUE | ";" | 59 | 0x3b | 0b00111011 | true (PL_sv_yes)
|
|
1.1.3
by Alexandre Mestiashvili
Import upstream version 2.03 |
70 |
MANY | "<" | 60 | 0x3c | 0b00111100 | <LEN-VARINT> <TYPE-BYTE> <TAG-DATA> - repeated tag (not done yet, will be implemented in version 3)
|
1
by Alexandre Mestiashvili
Import upstream version 0.31 |
71 |
PACKET_START | "=" | 61 | 0x3d | 0b00111101 | (first byte of magic string in header)
|
72 |
EXTEND | ">" | 62 | 0x3e | 0b00111110 | <BYTE> - for additional tags
|
|
73 |
PAD | "?" | 63 | 0x3f | 0b00111111 | (ignored tag, skip to next byte)
|
|
74 |
ARRAYREF_0 | "\@" | 64 | 0x40 | 0b01000000 | [<ITEM-TAG> ...] - count of items in low 4 bits (ARRAY must be refcnt=1)
|
|
75 |
ARRAYREF_1 | "A" | 65 | 0x41 | 0b01000001 |
|
|
76 |
ARRAYREF_2 | "B" | 66 | 0x42 | 0b01000010 |
|
|
77 |
ARRAYREF_3 | "C" | 67 | 0x43 | 0b01000011 |
|
|
78 |
ARRAYREF_4 | "D" | 68 | 0x44 | 0b01000100 |
|
|
79 |
ARRAYREF_5 | "E" | 69 | 0x45 | 0b01000101 |
|
|
80 |
ARRAYREF_6 | "F" | 70 | 0x46 | 0b01000110 |
|
|
81 |
ARRAYREF_7 | "G" | 71 | 0x47 | 0b01000111 |
|
|
82 |
ARRAYREF_8 | "H" | 72 | 0x48 | 0b01001000 |
|
|
83 |
ARRAYREF_9 | "I" | 73 | 0x49 | 0b01001001 |
|
|
84 |
ARRAYREF_10 | "J" | 74 | 0x4a | 0b01001010 |
|
|
85 |
ARRAYREF_11 | "K" | 75 | 0x4b | 0b01001011 |
|
|
86 |
ARRAYREF_12 | "L" | 76 | 0x4c | 0b01001100 |
|
|
87 |
ARRAYREF_13 | "M" | 77 | 0x4d | 0b01001101 |
|
|
88 |
ARRAYREF_14 | "N" | 78 | 0x4e | 0b01001110 |
|
|
89 |
ARRAYREF_15 | "O" | 79 | 0x4f | 0b01001111 | [<ITEM-TAG> ...] - count of items in low 4 bits (ARRAY must be refcnt=1)
|
|
90 |
HASHREF_0 | "P" | 80 | 0x50 | 0b01010000 | [<KEY-TAG> <ITEM-TAG> ...] - count in low 4 bits, key/value pairs (HASH must be refcnt=1)
|
|
91 |
HASHREF_1 | "Q" | 81 | 0x51 | 0b01010001 |
|
|
92 |
HASHREF_2 | "R" | 82 | 0x52 | 0b01010010 |
|
|
93 |
HASHREF_3 | "S" | 83 | 0x53 | 0b01010011 |
|
|
94 |
HASHREF_4 | "T" | 84 | 0x54 | 0b01010100 |
|
|
95 |
HASHREF_5 | "U" | 85 | 0x55 | 0b01010101 |
|
|
96 |
HASHREF_6 | "V" | 86 | 0x56 | 0b01010110 |
|
|
97 |
HASHREF_7 | "W" | 87 | 0x57 | 0b01010111 |
|
|
98 |
HASHREF_8 | "X" | 88 | 0x58 | 0b01011000 |
|
|
99 |
HASHREF_9 | "Y" | 89 | 0x59 | 0b01011001 |
|
|
100 |
HASHREF_10 | "Z" | 90 | 0x5a | 0b01011010 |
|
|
101 |
HASHREF_11 | "[" | 91 | 0x5b | 0b01011011 |
|
|
102 |
HASHREF_12 | "\\" | 92 | 0x5c | 0b01011100 |
|
|
103 |
HASHREF_13 | "]" | 93 | 0x5d | 0b01011101 |
|
|
104 |
HASHREF_14 | "^" | 94 | 0x5e | 0b01011110 |
|
|
105 |
HASHREF_15 | "_" | 95 | 0x5f | 0b01011111 | [<KEY-TAG> <ITEM-TAG> ...] - count in low 4 bits, key/value pairs (HASH must be refcnt=1)
|
|
106 |
SHORT_BINARY_0 | "`" | 96 | 0x60 | 0b01100000 | <BYTES> - binary/latin1 string, length encoded in low 5 bits of tag
|
|
107 |
SHORT_BINARY_1 | "a" | 97 | 0x61 | 0b01100001 |
|
|
108 |
SHORT_BINARY_2 | "b" | 98 | 0x62 | 0b01100010 |
|
|
109 |
SHORT_BINARY_3 | "c" | 99 | 0x63 | 0b01100011 |
|
|
110 |
SHORT_BINARY_4 | "d" | 100 | 0x64 | 0b01100100 |
|
|
111 |
SHORT_BINARY_5 | "e" | 101 | 0x65 | 0b01100101 |
|
|
112 |
SHORT_BINARY_6 | "f" | 102 | 0x66 | 0b01100110 |
|
|
113 |
SHORT_BINARY_7 | "g" | 103 | 0x67 | 0b01100111 |
|
|
114 |
SHORT_BINARY_8 | "h" | 104 | 0x68 | 0b01101000 |
|
|
115 |
SHORT_BINARY_9 | "i" | 105 | 0x69 | 0b01101001 |
|
|
116 |
SHORT_BINARY_10 | "j" | 106 | 0x6a | 0b01101010 |
|
|
117 |
SHORT_BINARY_11 | "k" | 107 | 0x6b | 0b01101011 |
|
|
118 |
SHORT_BINARY_12 | "l" | 108 | 0x6c | 0b01101100 |
|
|
119 |
SHORT_BINARY_13 | "m" | 109 | 0x6d | 0b01101101 |
|
|
120 |
SHORT_BINARY_14 | "n" | 110 | 0x6e | 0b01101110 |
|
|
121 |
SHORT_BINARY_15 | "o" | 111 | 0x6f | 0b01101111 |
|
|
122 |
SHORT_BINARY_16 | "p" | 112 | 0x70 | 0b01110000 |
|
|
123 |
SHORT_BINARY_17 | "q" | 113 | 0x71 | 0b01110001 |
|
|
124 |
SHORT_BINARY_18 | "r" | 114 | 0x72 | 0b01110010 |
|
|
125 |
SHORT_BINARY_19 | "s" | 115 | 0x73 | 0b01110011 |
|
|
126 |
SHORT_BINARY_20 | "t" | 116 | 0x74 | 0b01110100 |
|
|
127 |
SHORT_BINARY_21 | "u" | 117 | 0x75 | 0b01110101 |
|
|
128 |
SHORT_BINARY_22 | "v" | 118 | 0x76 | 0b01110110 |
|
|
129 |
SHORT_BINARY_23 | "w" | 119 | 0x77 | 0b01110111 |
|
|
130 |
SHORT_BINARY_24 | "x" | 120 | 0x78 | 0b01111000 |
|
|
131 |
SHORT_BINARY_25 | "y" | 121 | 0x79 | 0b01111001 |
|
|
132 |
SHORT_BINARY_26 | "z" | 122 | 0x7a | 0b01111010 |
|
|
133 |
SHORT_BINARY_27 | "{" | 123 | 0x7b | 0b01111011 |
|
|
134 |
SHORT_BINARY_28 | "|" | 124 | 0x7c | 0b01111100 |
|
|
135 |
SHORT_BINARY_29 | "}" | 125 | 0x7d | 0b01111101 |
|
|
136 |
SHORT_BINARY_30 | "~" | 126 | 0x7e | 0b01111110 |
|
|
137 |
SHORT_BINARY_31 | | 127 | 0x7f | 0b01111111 | <BYTES> - binary/latin1 string, length encoded in low 5 bits of tag
|
|
138 |
||
139 |
=for autoupdater stop
|
|
140 |
*/
|
|
141 |
||
142 |
/* magic string, protocol version and encoding information */
|
|
1.1.2
by Alexandre Mestiashvili
Import upstream version 0.37 |
143 |
#define SRL_MAGIC_STRLEN 4 /* Length of SRL_MAGIC_STRING */ |
1.1.10
by gregor herrmann
Import upstream version 3.001.002 |
144 |
|
1.1.9
by gregor herrmann
Import upstream version 3.001 |
145 |
#define SRL_MAGIC_STRING "=srl" /* Magic string for header. Every packet starts with this or "=\xF3rl", |
146 |
* which is the high-bit-set-on-the-"s" equivalent. */
|
|
1.1.10
by gregor herrmann
Import upstream version 3.001.002 |
147 |
#define SRL_MAGIC_STRING_UINT_LE 0x6C72733D /* SRL_MAGIC_STRING as a little endian integer */ |
148 |
#define SRL_MAGIC_STRING_UINT_BE 0x3D73726C /* SRL_MAGIC_STRING as a big endian integer */ |
|
149 |
||
1.1.9
by gregor herrmann
Import upstream version 3.001 |
150 |
#define SRL_MAGIC_STRING_HIGHBIT "=\xF3rl" /* Magic string for header, with high bit set for UTF8 sanity check. */ |
1.1.10
by gregor herrmann
Import upstream version 3.001.002 |
151 |
#define SRL_MAGIC_STRING_HIGHBIT_UINT_LE 0x6C72F33D /* SRL_MAGIC_STRING_HIGHBIT as a little endian integer */ |
152 |
#define SRL_MAGIC_STRING_HIGHBIT_UINT_BE 0x3DF3726C /* SRL_MAGIC_STRING_HIGHBIT as a big endian integer */ |
|
1.1.9
by gregor herrmann
Import upstream version 3.001 |
153 |
|
154 |
#define SRL_MAGIC_STRING_HIGHBIT_UTF8 "=\xC3\xB3rl" /* Magic string for header, corrupted by accidental UTF8 encoding */ |
|
1.1.10
by gregor herrmann
Import upstream version 3.001.002 |
155 |
#define SRL_MAGIC_STRING_HIGHBIT_UTF8_UINT_LE 0x72B3C33D /* first four bytes of SRL_MAGIC_STRING encoded as UTF8, little endian */ |
156 |
#define SRL_MAGIC_STRING_HIGHBIT_UTF8_UINT_BE 0x3DC3B372 /* first four bytes of SRL_MAGIC_STRING encoded as UTF8, big endian */ |
|
1.1.9
by gregor herrmann
Import upstream version 3.001 |
157 |
|
158 |
#define SRL_PROTOCOL_VERSION ( 3 )
|
|
1
by Alexandre Mestiashvili
Import upstream version 0.31 |
159 |
#define SRL_PROTOCOL_VERSION_BITS ( 4 ) /* how many bits we use for the version, the rest go to the encoding */ |
160 |
#define SRL_PROTOCOL_VERSION_MASK ( ( 1 << SRL_PROTOCOL_VERSION_BITS ) - 1 )
|
|
161 |
||
1.1.20
by Alexandre Mestiashvili
Import upstream version 3.005.001 |
162 |
#define SRL_PROTOCOL_ENCODING_MASK ( SRL_PROTOCOL_VERSION_MASK << SRL_PROTOCOL_VERSION_BITS )
|
1
by Alexandre Mestiashvili
Import upstream version 0.31 |
163 |
#define SRL_PROTOCOL_ENCODING_RAW ( 0 << SRL_PROTOCOL_VERSION_BITS )
|
164 |
#define SRL_PROTOCOL_ENCODING_SNAPPY ( 1 << SRL_PROTOCOL_VERSION_BITS )
|
|
165 |
#define SRL_PROTOCOL_ENCODING_SNAPPY_INCREMENTAL ( 2 << SRL_PROTOCOL_VERSION_BITS )
|
|
1.1.9
by gregor herrmann
Import upstream version 3.001 |
166 |
#define SRL_PROTOCOL_ENCODING_ZLIB ( 3 << SRL_PROTOCOL_VERSION_BITS )
|
1
by Alexandre Mestiashvili
Import upstream version 0.31 |
167 |
|
1.1.3
by Alexandre Mestiashvili
Import upstream version 2.03 |
168 |
/* Bits in the header bitfield */
|
169 |
#define SRL_PROTOCOL_HDR_USER_DATA ( 1 )
|
|
170 |
#define SRL_PROTOCOL_HDR_CONTINUE ( 8 ) /* TODO Describe in spec - not urgent since not meaningful yet */ |
|
1
by Alexandre Mestiashvili
Import upstream version 0.31 |
171 |
|
172 |
/* Useful constants */
|
|
173 |
/* See also range constants below for the header byte */
|
|
174 |
#define SRL_POS_MAX_SIZE 15
|
|
175 |
#define SRL_NEG_MIN_SIZE 16
|
|
176 |
||
177 |
/* All constants have the F bit (SRL_HDR_TRACK_FLAG) unset! */
|
|
178 |
/* _LOW and _HIGH versions refering to INCLUSIVE range boundaries */
|
|
179 |
||
180 |
||
1.1.20
by Alexandre Mestiashvili
Import upstream version 3.005.001 |
181 |
#define SRL_HDR_POS ((U8)0) /* small positive integer - value in low 4 bits (identity) */ |
182 |
#define SRL_HDR_POS_LOW ((U8)0) /* small positive integer - value in low 4 bits (identity) */ |
|
183 |
#define SRL_HDR_POS_HIGH ((U8)15) /* small positive integer - value in low 4 bits (identity) */ |
|
184 |
||
185 |
#define SRL_HDR_NEG ((U8)16) /* small negative integer - value in low 4 bits (k+32) */ |
|
186 |
#define SRL_HDR_NEG_LOW ((U8)16) /* small negative integer - value in low 4 bits (k+32) */ |
|
187 |
#define SRL_HDR_NEG_HIGH ((U8)31) /* small negative integer - value in low 4 bits (k+32) */ |
|
188 |
||
189 |
#define SRL_HDR_VARINT ((U8)32) /* <VARINT> - Varint variable length integer */ |
|
190 |
#define SRL_HDR_ZIGZAG ((U8)33) /* <ZIGZAG-VARINT> - Zigzag variable length integer */ |
|
191 |
#define SRL_HDR_FLOAT ((U8)34) /* <IEEE-FLOAT> */ |
|
192 |
#define SRL_HDR_DOUBLE ((U8)35) /* <IEEE-DOUBLE> */ |
|
193 |
#define SRL_HDR_LONG_DOUBLE ((U8)36) /* <IEEE-LONG-DOUBLE> */ |
|
194 |
#define SRL_HDR_UNDEF ((U8)37) /* None - Perl undef var; eg my $var= undef; */ |
|
195 |
#define SRL_HDR_BINARY ((U8)38) /* <LEN-VARINT> <BYTES> - binary/(latin1) string */ |
|
196 |
#define SRL_HDR_STR_UTF8 ((U8)39) /* <LEN-VARINT> <UTF8> - utf8 string */ |
|
197 |
||
198 |
#define SRL_HDR_REFN ((U8)40) /* <ITEM-TAG> - ref to next item */ |
|
199 |
#define SRL_HDR_REFP ((U8)41) /* <OFFSET-VARINT> - ref to previous item stored at offset */ |
|
200 |
#define SRL_HDR_HASH ((U8)42) /* <COUNT-VARINT> [<KEY-TAG> <ITEM-TAG> ...] - count followed by key/value pairs */ |
|
201 |
#define SRL_HDR_ARRAY ((U8)43) /* <COUNT-VARINT> [<ITEM-TAG> ...] - count followed by items */ |
|
202 |
#define SRL_HDR_OBJECT ((U8)44) /* <STR-TAG> <ITEM-TAG> - class, object-item */ |
|
203 |
#define SRL_HDR_OBJECTV ((U8)45) /* <OFFSET-VARINT> <ITEM-TAG> - offset of previously used classname tag - object-item */ |
|
204 |
#define SRL_HDR_ALIAS ((U8)46) /* <OFFSET-VARINT> - alias to item defined at offset */ |
|
205 |
#define SRL_HDR_COPY ((U8)47) /* <OFFSET-VARINT> - copy of item defined at offset */ |
|
206 |
||
207 |
#define SRL_HDR_WEAKEN ((U8)48) /* <REF-TAG> - Weaken the following reference */ |
|
208 |
#define SRL_HDR_REGEXP ((U8)49) /* <PATTERN-STR-TAG> <MODIFIERS-STR-TAG>*/ |
|
209 |
||
210 |
#define SRL_HDR_OBJECT_FREEZE ((U8)50) /* <STR-TAG> <ITEM-TAG> - class, object-item. Need to call "THAW" method on class after decoding */ |
|
211 |
#define SRL_HDR_OBJECTV_FREEZE ((U8)51) /* <OFFSET-VARINT> <ITEM-TAG> - (OBJECTV_FREEZE is to OBJECT_FREEZE as OBJECTV is to OBJECT) */ |
|
1.1.3
by Alexandre Mestiashvili
Import upstream version 2.03 |
212 |
|
1
by Alexandre Mestiashvili
Import upstream version 0.31 |
213 |
/* Note: Can do reserved check with a range now, but as we start using
|
214 |
* them, might have to explicit == check later. */
|
|
1.1.20
by Alexandre Mestiashvili
Import upstream version 3.005.001 |
215 |
#define SRL_HDR_RESERVED ((U8)52) /* reserved */ |
216 |
#define SRL_HDR_RESERVED_LOW ((U8)52)
|
|
217 |
#define SRL_HDR_RESERVED_HIGH ((U8)56)
|
|
218 |
||
219 |
#define SRL_HDR_CANONICAL_UNDEF ((U8)57) /* undef (PL_sv_undef) - "the" Perl undef (see notes) */ |
|
220 |
#define SRL_HDR_FALSE ((U8)58) /* false (PL_sv_no) */ |
|
221 |
#define SRL_HDR_TRUE ((U8)59) /* true (PL_sv_yes) */ |
|
222 |
||
223 |
#define SRL_HDR_MANY ((U8)60) /* <LEN-VARINT> <TYPE-BYTE> <TAG-DATA> - repeated tag (not done yet, will be implemented in version 3) */ |
|
224 |
#define SRL_HDR_PACKET_START ((U8)61) /* (first byte of magic string in header) */ |
|
225 |
||
226 |
||
227 |
#define SRL_HDR_EXTEND ((U8)62) /* <BYTE> - for additional tags */ |
|
228 |
#define SRL_HDR_PAD ((U8)63) /* (ignored tag, skip to next byte) */ |
|
229 |
#define SRL_HDR_ARRAYREF ((U8)64) /* [<ITEM-TAG> ...] - count of items in low 4 bits (ARRAY must be refcnt=1)*/ |
|
230 |
#define SRL_MASK_ARRAYREF_COUNT ((U8)15) /* mask to get low bits from tag */ |
|
231 |
#define SRL_HDR_ARRAYREF_LOW ((U8)64)
|
|
232 |
#define SRL_HDR_ARRAYREF_HIGH ((U8)79)
|
|
233 |
||
234 |
||
235 |
#define SRL_HDR_HASHREF ((U8)80) /* [<KEY-TAG> <ITEM-TAG> ...] - count in low 4 bits, key/value pairs (HASH must be refcnt=1)*/ |
|
236 |
#define SRL_MASK_HASHREF_COUNT ((U8)15) /* mask to get low bits from tag */ |
|
237 |
#define SRL_HDR_HASHREF_LOW ((U8)80)
|
|
238 |
#define SRL_HDR_HASHREF_HIGH ((U8)95)
|
|
239 |
||
240 |
#define SRL_HDR_SHORT_BINARY ((U8)96) /* <BYTES> - binary/latin1 string, length encoded in low 5 bits of tag */ |
|
241 |
#define SRL_HDR_SHORT_BINARY_LOW ((U8)96)
|
|
242 |
#define SRL_HDR_SHORT_BINARY_HIGH ((U8)127)
|
|
243 |
#define SRL_MASK_SHORT_BINARY_LEN ((U8)31) /* mask to get length of SRL_HDR_SHORT_BINARY type tags */ |
|
244 |
||
245 |
#define SRL_HDR_TRACK_FLAG ((U8)128) /* if this bit is set track the item */ |
|
1
by Alexandre Mestiashvili
Import upstream version 0.31 |
246 |
|
247 |
/* TODO */
|
|
248 |
||
1.1.14
by gregor herrmann
Import upstream version 3.001.006 |
249 |
#define SRL_SET_TRACK_FLAG(where) ((where) |= SRL_HDR_TRACK_FLAG)
|
1
by Alexandre Mestiashvili
Import upstream version 0.31 |
250 |
|
251 |
#endif
|