marshal.go 83.3 KB
Newer Older
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1 2
// DO NOT EDIT - AUTOGENERATED (by protogen.go)

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3 4
package neo

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
5 6
import (
	"encoding/binary"
7
	"sort"
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
8 9
)

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
10 11
// 0. Address

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
12
func (p *Address) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
13
	return 6 + len(p.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
14 15
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
16
func (p *Address) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
17 18 19 20 21
	{
		l := uint32(len(p.Host))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		copy(data, p.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
22
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
23
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
24 25
	binary.BigEndian.PutUint16(data[0:], p.Port)
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
26

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
27
func (p *Address) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
28
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
29
	{
30 31 32
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
33
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
34
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
35
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
36
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
37 38 39
		}
		p.Host = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
40
		nread0 += 4 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
41
	}
42 43 44
	if len(data) < 2 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
45
	p.Port = binary.BigEndian.Uint16(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
46
	return 2 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
47 48 49

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
50
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
51

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
52 53
// 1. NodeInfo

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
54
func (p *NodeInfo) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
55
	return 26 + len(p.Address.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
56 57
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
58
func (p *NodeInfo) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
59
	binary.BigEndian.PutUint32(data[0:], uint32(int32(p.NodeType)))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
60 61 62 63 64
	{
		l := uint32(len(p.Address.Host))
		binary.BigEndian.PutUint32(data[4:], l)
		data = data[8:]
		copy(data, p.Address.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
65
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
66 67 68 69 70
	}
	binary.BigEndian.PutUint16(data[0:], p.Address.Port)
	binary.BigEndian.PutUint32(data[2:], uint32(int32(p.UUID)))
	binary.BigEndian.PutUint32(data[6:], uint32(int32(p.NodeState)))
	float64_NEOEncode(data[10:], p.IdTimestamp)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
71
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
72

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
73
func (p *NodeInfo) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
74
	var nread0 uint32
75 76 77
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
78
	p.NodeType = NodeType(int32(binary.BigEndian.Uint32(data[0:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
79
	{
80 81 82
		if len(data) < 8 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
83
		l := binary.BigEndian.Uint32(data[4:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
84
		data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
85
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
86
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
87 88 89
		}
		p.Address.Host = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
90
		nread0 += 8 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
91
	}
92 93 94
	if len(data) < 2 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
95
	p.Address.Port = binary.BigEndian.Uint16(data[0:])
96 97 98
	if len(data) < 6 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
99
	p.UUID = UUID(int32(binary.BigEndian.Uint32(data[2:])))
100 101 102
	if len(data) < 10 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
103
	p.NodeState = NodeState(int32(binary.BigEndian.Uint32(data[6:])))
104 105 106
	if len(data) < 18 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
107
	p.IdTimestamp = float64_NEODecode(data[10:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
108
	return 18 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
109 110 111

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
112
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
113

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
114 115
// 2. CellInfo

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
116
func (p *CellInfo) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
117
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
118 119
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
120
func (p *CellInfo) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
121 122 123
	binary.BigEndian.PutUint32(data[0:], uint32(int32(p.UUID)))
	binary.BigEndian.PutUint32(data[4:], uint32(int32(p.CellState)))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
124

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
125
func (p *CellInfo) NEODecode(data []byte) (int, error) {
126 127 128
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
129
	p.UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
130 131 132
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
133
	p.CellState = CellState(int32(binary.BigEndian.Uint32(data[4:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
134
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
135 136 137

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
138
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
139

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
140 141
// 3. RowInfo

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
142
func (p *RowInfo) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
143
	return 8 + len(p.CellList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
144 145
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
146
func (p *RowInfo) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
147
	binary.BigEndian.PutUint32(data[0:], p.Offset)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
148 149 150 151 152 153 154 155 156 157 158
	{
		l := uint32(len(p.CellList))
		binary.BigEndian.PutUint32(data[4:], l)
		data = data[8:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.CellList[i]
			binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).UUID)))
			binary.BigEndian.PutUint32(data[4:], uint32(int32((*a).CellState)))
			data = data[8:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
159
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
160

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
161
func (p *RowInfo) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
162
	var nread0 uint32
163 164 165
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
166
	p.Offset = binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
167
	{
168 169 170
		if len(data) < 8 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
171
		l := binary.BigEndian.Uint32(data[4:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
172
		data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
173
		nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
174
		p.CellList = make([]CellInfo, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
175
		for i := 0; uint32(i) < l; i++ {
176
			a := &p.CellList[i]
177 178 179
			if len(data) < 4 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
180
			(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
181 182 183
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
184
			(*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
185
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
186
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
187 188
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
189
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
190 191 192

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
193
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
194

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
// 4. XXXTest

func (p *XXXTest) NEOEncodedLen() int {
	var size0 int
	for i := 0; i < len(p.Zzz); i++ {
		a := &p.Zzz[i]
		var size1 int
		for i := 0; i < len((*a)); i++ {
			a := &(*a)[i]

			size1 += 4 + len((*a))
		}

		size0 += 4 + size1
	}
	return 12 + size0
}

func (p *XXXTest) NEOEncode(data []byte) {
	binary.BigEndian.PutUint32(data[0:], p.qqq)
	binary.BigEndian.PutUint32(data[4:], p.aaa)
	{
		l := uint32(len(p.Zzz))
		binary.BigEndian.PutUint32(data[8:], l)
		data = data[12:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.Zzz[i]
			{
				l := uint32(len((*a)))
				binary.BigEndian.PutUint32(data[0:], l)
				data = data[4:]
				for i := 0; uint32(i) < l; i++ {
					a := &(*a)[i]
					{
						l := uint32(len((*a)))
						binary.BigEndian.PutUint32(data[0:], l)
						data = data[4:]
						copy(data, (*a))
						data = data[l:]
					}
					data = data[0:]
				}
			}
			data = data[0:]
		}
	}
}

func (p *XXXTest) NEODecode(data []byte) (int, error) {
	var nread0 uint32
	if len(data) < 4 {
		goto overflow
	}
	p.qqq = binary.BigEndian.Uint32(data[0:])
	if len(data) < 8 {
		goto overflow
	}
	p.aaa = binary.BigEndian.Uint32(data[4:])
	{
		if len(data) < 12 {
			goto overflow
		}
		l := binary.BigEndian.Uint32(data[8:])
		data = data[12:]
		nread0 += 12
		p.Zzz = make([][]string, l)
		for i := 0; uint32(i) < l; i++ {
			a := &p.Zzz[i]
			{
				if len(data) < 4 {
					goto overflow
				}
				l := binary.BigEndian.Uint32(data[0:])
				data = data[4:]
				nread0 += 4
				(*a) = make([]string, l)
				for i := 0; uint32(i) < l; i++ {
					a := &(*a)[i]
					{
						if len(data) < 4 {
							goto overflow
						}
						l := binary.BigEndian.Uint32(data[0:])
						data = data[4:]
						if uint32(len(data)) < l {
							goto overflow
						}
						(*a) = string(data[:l])
						data = data[l:]
						nread0 += 4 + l
					}
					data = data[0:]
					nread0 += 0
				}
			}
			data = data[0:]
			nread0 += 0
		}
	}
	return 0 + int(nread0), nil

overflow:
	return 0, ErrDecodeOverflow
}

// 5. Notify
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
301

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
302
func (p *Notify) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
303
	return 4 + len(p.Message)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
304 305
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
306
func (p *Notify) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
307 308 309 310 311
	{
		l := uint32(len(p.Message))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		copy(data, p.Message)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
312
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
313
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
314
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
315

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
316
func (p *Notify) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
317
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
318
	{
319 320 321
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
322
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
323
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
324
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
325
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
326 327 328
		}
		p.Message = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
329
		nread0 += 4 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
330
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
331
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
332 333 334

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
335
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
336

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
337
// 6. Error
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
338

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
339
func (p *Error) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
340
	return 8 + len(p.Message)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
341 342
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
343
func (p *Error) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
344
	binary.BigEndian.PutUint32(data[0:], p.Code)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
345 346 347 348 349
	{
		l := uint32(len(p.Message))
		binary.BigEndian.PutUint32(data[4:], l)
		data = data[8:]
		copy(data, p.Message)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
350
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
351
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
352
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
353

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
354
func (p *Error) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
355
	var nread0 uint32
356 357 358
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
359
	p.Code = binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
360
	{
361 362 363
		if len(data) < 8 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
364
		l := binary.BigEndian.Uint32(data[4:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
365
		data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
366
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
367
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
368 369 370
		}
		p.Message = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
371
		nread0 += 8 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
372
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
373
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
374 375 376

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
377
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
378

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
379
// 7. Ping
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
380

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
381
func (p *Ping) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
382
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
383 384
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
385
func (p *Ping) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
386
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
387

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
388
func (p *Ping) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
389
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
390
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
391

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
392
// 8. CloseClient
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
393

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
394
func (p *CloseClient) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
395
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
396 397
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
398
func (p *CloseClient) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
399
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
400

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
401
func (p *CloseClient) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
402
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
403
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
404

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
405
// 9. RequestIdentification
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
406

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
407
func (p *RequestIdentification) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
408
	return 30 + len(p.Address.Host) + len(p.Name)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
409 410
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
411
func (p *RequestIdentification) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
412 413 414
	binary.BigEndian.PutUint32(data[0:], p.ProtocolVersion)
	binary.BigEndian.PutUint32(data[4:], uint32(int32(p.NodeType)))
	binary.BigEndian.PutUint32(data[8:], uint32(int32(p.UUID)))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
415 416 417 418 419
	{
		l := uint32(len(p.Address.Host))
		binary.BigEndian.PutUint32(data[12:], l)
		data = data[16:]
		copy(data, p.Address.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
420
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
421 422 423 424 425 426 427
	}
	binary.BigEndian.PutUint16(data[0:], p.Address.Port)
	{
		l := uint32(len(p.Name))
		binary.BigEndian.PutUint32(data[2:], l)
		data = data[6:]
		copy(data, p.Name)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
428
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
429 430
	}
	float64_NEOEncode(data[0:], p.IdTimestamp)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
431
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
432

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
433
func (p *RequestIdentification) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
434
	var nread0 uint32
435 436 437
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
438
	p.ProtocolVersion = binary.BigEndian.Uint32(data[0:])
439 440 441
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
442
	p.NodeType = NodeType(int32(binary.BigEndian.Uint32(data[4:])))
443 444 445
	if len(data) < 12 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
446
	p.UUID = UUID(int32(binary.BigEndian.Uint32(data[8:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
447
	{
448 449 450
		if len(data) < 16 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
451
		l := binary.BigEndian.Uint32(data[12:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
452
		data = data[16:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
453
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
454
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
455 456 457
		}
		p.Address.Host = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
458
		nread0 += 16 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
459
	}
460 461 462
	if len(data) < 2 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
463
	p.Address.Port = binary.BigEndian.Uint16(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
464
	{
465 466 467
		if len(data) < 6 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
468
		l := binary.BigEndian.Uint32(data[2:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
469
		data = data[6:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
470
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
471
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
472 473 474
		}
		p.Name = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
475
		nread0 += 6 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
476
	}
477 478 479
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
480
	p.IdTimestamp = float64_NEODecode(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
481
	return 8 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
482 483 484

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
485
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
486

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
487
// 10. AcceptIdentification
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
488

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
489
func (p *AcceptIdentification) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
490
	var size0 int
Kirill Smelkov's avatar
Kirill Smelkov committed
491 492
	for i := 0; i < len(p.KnownMasterList); i++ {
		a := &p.KnownMasterList[i]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
493

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
494
		size0 += 10 + len((*a).Address.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
495
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
496
	return 30 + len(p.Primary.Host) + size0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
497 498
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
499
func (p *AcceptIdentification) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
500 501 502 503 504
	binary.BigEndian.PutUint32(data[0:], uint32(int32(p.NodeType)))
	binary.BigEndian.PutUint32(data[4:], uint32(int32(p.MyUUID)))
	binary.BigEndian.PutUint32(data[8:], p.NumPartitions)
	binary.BigEndian.PutUint32(data[12:], p.NumReplicas)
	binary.BigEndian.PutUint32(data[16:], uint32(int32(p.YourUUID)))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
505 506 507 508 509
	{
		l := uint32(len(p.Primary.Host))
		binary.BigEndian.PutUint32(data[20:], l)
		data = data[24:]
		copy(data, p.Primary.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
510
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
511 512
	}
	binary.BigEndian.PutUint16(data[0:], p.Primary.Port)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
513 514 515 516 517 518 519 520 521 522 523
	{
		l := uint32(len(p.KnownMasterList))
		binary.BigEndian.PutUint32(data[2:], l)
		data = data[6:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.KnownMasterList[i]
			{
				l := uint32(len((*a).Address.Host))
				binary.BigEndian.PutUint32(data[0:], l)
				data = data[4:]
				copy(data, (*a).Address.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
524
				data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
525 526 527 528 529 530
			}
			binary.BigEndian.PutUint16(data[0:], (*a).Address.Port)
			binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID)))
			data = data[6:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
531
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
532

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
533
func (p *AcceptIdentification) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
534
	var nread0 uint32
535 536 537
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
538
	p.NodeType = NodeType(int32(binary.BigEndian.Uint32(data[0:])))
539 540 541
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
542
	p.MyUUID = UUID(int32(binary.BigEndian.Uint32(data[4:])))
543 544 545
	if len(data) < 12 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
546
	p.NumPartitions = binary.BigEndian.Uint32(data[8:])
547 548 549
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
550
	p.NumReplicas = binary.BigEndian.Uint32(data[12:])
551 552 553
	if len(data) < 20 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
554
	p.YourUUID = UUID(int32(binary.BigEndian.Uint32(data[16:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
555
	{
556 557 558
		if len(data) < 24 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
559
		l := binary.BigEndian.Uint32(data[20:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
560
		data = data[24:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
561
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
562
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
563 564 565
		}
		p.Primary.Host = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
566
		nread0 += 24 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
567
	}
568 569 570
	if len(data) < 2 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
571
	p.Primary.Port = binary.BigEndian.Uint16(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
572
	{
573 574 575
		if len(data) < 6 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
576
		l := binary.BigEndian.Uint32(data[2:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
577
		data = data[6:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
578
		nread0 += 6
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
579
		p.KnownMasterList = make([]struct {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
580 581
			Address
			UUID UUID
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
582
		}, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
583
		for i := 0; uint32(i) < l; i++ {
584
			a := &p.KnownMasterList[i]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
585
			{
586 587 588
				if len(data) < 4 {
					goto overflow
				}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
589
				l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
590
				data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
591
				if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
592
					goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
593
				}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
594
				(*a).Address.Host = string(data[:l])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
595
				data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
596
				nread0 += 4 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
597
			}
598 599 600
			if len(data) < 2 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
601
			(*a).Address.Port = binary.BigEndian.Uint16(data[0:])
602 603 604
			if len(data) < 6 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
605
			(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[2:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
606
			data = data[6:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
607
			nread0 += 6
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
608 609
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
610
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
611 612 613

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
614
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
615

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
616
// 11. PrimaryMaster
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
617

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
618
func (p *PrimaryMaster) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
619
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
620 621
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
622
func (p *PrimaryMaster) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
623
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
624

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
625
func (p *PrimaryMaster) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
626
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
627
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
628

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
629
// 12. AnswerPrimary
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
630

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
631
func (p *AnswerPrimary) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
632
	return 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
633 634
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
635
func (p *AnswerPrimary) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
636 637
	binary.BigEndian.PutUint32(data[0:], uint32(int32(p.PrimaryUUID)))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
638

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
639
func (p *AnswerPrimary) NEODecode(data []byte) (int, error) {
640 641 642
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
643
	p.PrimaryUUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
644
	return 4, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
645 646 647

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
648
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
649

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
650
// 13. AnnouncePrimary
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
651

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
652
func (p *AnnouncePrimary) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
653
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
654 655
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
656
func (p *AnnouncePrimary) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
657
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
658

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
659
func (p *AnnouncePrimary) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
660
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
661
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
662

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
663
// 14. ReelectPrimary
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
664

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
665
func (p *ReelectPrimary) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
666
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
667 668
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
669
func (p *ReelectPrimary) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
670
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
671

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
672
func (p *ReelectPrimary) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
673
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
674
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
675

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
676
// 15. Recovery
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
677

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
678
func (p *Recovery) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
679
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
680 681
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
682
func (p *Recovery) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
683
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
684

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
685
func (p *Recovery) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
686
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
687
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
688

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
689
// 16. AnswerRecovery
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
690

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
691
func (p *AnswerRecovery) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
692
	return 24
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
693 694
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
695
func (p *AnswerRecovery) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
696 697 698 699
	binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
	binary.BigEndian.PutUint64(data[8:], uint64(p.BackupTID))
	binary.BigEndian.PutUint64(data[16:], uint64(p.TruncateTID))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
700

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
701
func (p *AnswerRecovery) NEODecode(data []byte) (int, error) {
702 703 704
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
705
	p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
706 707 708
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
709
	p.BackupTID = Tid(binary.BigEndian.Uint64(data[8:]))
710 711 712
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
713
	p.TruncateTID = Tid(binary.BigEndian.Uint64(data[16:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
714
	return 24, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
715 716 717

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
718
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
719

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
720
// 17. LastIDs
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
721

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
722
func (p *LastIDs) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
723
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
724 725
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
726
func (p *LastIDs) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
727
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
728

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
729
func (p *LastIDs) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
730
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
731
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
732

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
733
// 18. AnswerLastIDs
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
734

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
735
func (p *AnswerLastIDs) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
736
	return 16
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
737 738
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
739
func (p *AnswerLastIDs) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
740 741 742
	binary.BigEndian.PutUint64(data[0:], uint64(p.LastOID))
	binary.BigEndian.PutUint64(data[8:], uint64(p.LastTID))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
743

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
744
func (p *AnswerLastIDs) NEODecode(data []byte) (int, error) {
745 746 747
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
748
	p.LastOID = Oid(binary.BigEndian.Uint64(data[0:]))
749 750 751
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
752
	p.LastTID = Tid(binary.BigEndian.Uint64(data[8:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
753
	return 16, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
754 755 756

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
757
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
758

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
759
// 19. PartitionTable
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
760

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
761
func (p *PartitionTable) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
762
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
763 764
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
765
func (p *PartitionTable) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
766
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
767

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
768
func (p *PartitionTable) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
769
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
770
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
771

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
772
// 20. AnswerPartitionTable
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
773

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
774
func (p *AnswerPartitionTable) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
775
	var size0 int
Kirill Smelkov's avatar
Kirill Smelkov committed
776 777
	for i := 0; i < len(p.RowList); i++ {
		a := &p.RowList[i]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
778

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
779
		size0 += 8 + len((*a).CellList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
780
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
781
	return 12 + size0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
782 783
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
784
func (p *AnswerPartitionTable) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
785
	binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806
	{
		l := uint32(len(p.RowList))
		binary.BigEndian.PutUint32(data[8:], l)
		data = data[12:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.RowList[i]
			binary.BigEndian.PutUint32(data[0:], (*a).Offset)
			{
				l := uint32(len((*a).CellList))
				binary.BigEndian.PutUint32(data[4:], l)
				data = data[8:]
				for i := 0; uint32(i) < l; i++ {
					a := &(*a).CellList[i]
					binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).UUID)))
					binary.BigEndian.PutUint32(data[4:], uint32(int32((*a).CellState)))
					data = data[8:]
				}
			}
			data = data[0:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
807
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
808

809
func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
810
	var nread0 uint32
811 812 813
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
814
	p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
815
	{
816 817 818
		if len(data) < 12 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
819
		l := binary.BigEndian.Uint32(data[8:])
820
		data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
821
		nread0 += 12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
822
		p.RowList = make([]RowInfo, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
823
		for i := 0; uint32(i) < l; i++ {
824
			a := &p.RowList[i]
825 826 827
			if len(data) < 4 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
828
			(*a).Offset = binary.BigEndian.Uint32(data[0:])
829
			{
830 831 832
				if len(data) < 8 {
					goto overflow
				}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
833
				l := binary.BigEndian.Uint32(data[4:])
834
				data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
835
				nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
836
				(*a).CellList = make([]CellInfo, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
837
				for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
838
					a := &(*a).CellList[i]
839 840 841
					if len(data) < 4 {
						goto overflow
					}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
842
					(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
843 844 845
					if len(data) < 8 {
						goto overflow
					}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
846
					(*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:])))
847
					data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
848
					nread0 += 8
849 850 851
				}
			}
			data = data[0:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
852
			nread0 += 0
853 854
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
855
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
856 857 858

overflow:
	return 0, ErrDecodeOverflow
859
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
860

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
861
// 21. NotifyPartitionTable
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
862

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
863
func (p *NotifyPartitionTable) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
864
	var size0 int
Kirill Smelkov's avatar
Kirill Smelkov committed
865 866
	for i := 0; i < len(p.RowList); i++ {
		a := &p.RowList[i]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
867

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
868
		size0 += 8 + len((*a).CellList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
869
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
870
	return 12 + size0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
871 872
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
873
func (p *NotifyPartitionTable) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
874
	binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895
	{
		l := uint32(len(p.RowList))
		binary.BigEndian.PutUint32(data[8:], l)
		data = data[12:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.RowList[i]
			binary.BigEndian.PutUint32(data[0:], (*a).Offset)
			{
				l := uint32(len((*a).CellList))
				binary.BigEndian.PutUint32(data[4:], l)
				data = data[8:]
				for i := 0; uint32(i) < l; i++ {
					a := &(*a).CellList[i]
					binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).UUID)))
					binary.BigEndian.PutUint32(data[4:], uint32(int32((*a).CellState)))
					data = data[8:]
				}
			}
			data = data[0:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
896
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
897

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
898
func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
899
	var nread0 uint32
900 901 902
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
903
	p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
904
	{
905 906 907
		if len(data) < 12 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
908
		l := binary.BigEndian.Uint32(data[8:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
909
		data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
910
		nread0 += 12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
911
		p.RowList = make([]RowInfo, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
912
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
913
			a := &p.RowList[i]
914 915 916
			if len(data) < 4 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
917
			(*a).Offset = binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
918
			{
919 920 921
				if len(data) < 8 {
					goto overflow
				}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
922
				l := binary.BigEndian.Uint32(data[4:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
923
				data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
924
				nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
925
				(*a).CellList = make([]CellInfo, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
926
				for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
927
					a := &(*a).CellList[i]
928 929 930
					if len(data) < 4 {
						goto overflow
					}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
931
					(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
932 933 934
					if len(data) < 8 {
						goto overflow
					}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
935
					(*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
936
					data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
937
					nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
938 939 940
				}
			}
			data = data[0:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
941
			nread0 += 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
942 943
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
944
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
945 946 947

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
948
}
949

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
950
// 22. PartitionChanges
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
951

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
952
func (p *PartitionChanges) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
953
	return 12 + len(p.CellList)*12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
954 955
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
956
func (p *PartitionChanges) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
957
	binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
958 959 960 961 962 963 964 965 966 967 968 969
	{
		l := uint32(len(p.CellList))
		binary.BigEndian.PutUint32(data[8:], l)
		data = data[12:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.CellList[i]
			binary.BigEndian.PutUint32(data[0:], (*a).Offset)
			binary.BigEndian.PutUint32(data[4:], uint32(int32((*a).UUID)))
			binary.BigEndian.PutUint32(data[8:], uint32(int32((*a).CellState)))
			data = data[12:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
970
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
971

972
func (p *PartitionChanges) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
973
	var nread0 uint32
974 975 976
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
977
	p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
978
	{
979 980 981
		if len(data) < 12 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
982
		l := binary.BigEndian.Uint32(data[8:])
983
		data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
984
		nread0 += 12
985 986
		p.CellList = make([]struct {
			Offset    uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
987 988
			UUID      UUID
			CellState CellState
989
		}, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
990
		for i := 0; uint32(i) < l; i++ {
991
			a := &p.CellList[i]
992 993 994
			if len(data) < 4 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
995
			(*a).Offset = binary.BigEndian.Uint32(data[0:])
996 997 998
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
999
			(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[4:])))
1000 1001 1002
			if len(data) < 12 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1003
			(*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[8:])))
1004
			data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1005
			nread0 += 12
1006 1007
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1008
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1009 1010 1011

overflow:
	return 0, ErrDecodeOverflow
1012
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1013

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1014
// 23. StartOperation
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1015

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1016
func (p *StartOperation) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1017
	return 1
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1018 1019
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1020
func (p *StartOperation) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1021 1022
	(data[0:])[0] = bool2byte(p.Backup)
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1023

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1024
func (p *StartOperation) NEODecode(data []byte) (int, error) {
1025 1026 1027
	if len(data) < 1 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1028
	p.Backup = byte2bool((data[0:])[0])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1029
	return 1, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1030 1031 1032

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1033 1034
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1035
// 24. StopOperation
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1036

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1037
func (p *StopOperation) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1038
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1039 1040
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1041
func (p *StopOperation) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1042
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1043

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1044
func (p *StopOperation) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1045
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1046 1047
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1048
// 25. UnfinishedTransactions
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1049

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1050
func (p *UnfinishedTransactions) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1051
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1052 1053
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1054
func (p *UnfinishedTransactions) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1055
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1056

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1057
func (p *UnfinishedTransactions) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1058
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1059 1060
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1061
// 26. AnswerUnfinishedTransactions
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1062

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1063
func (p *AnswerUnfinishedTransactions) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1064
	return 12 + len(p.TidList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1065 1066
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1067
func (p *AnswerUnfinishedTransactions) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1068
	binary.BigEndian.PutUint64(data[0:], uint64(p.MaxTID))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078
	{
		l := uint32(len(p.TidList))
		binary.BigEndian.PutUint32(data[8:], l)
		data = data[12:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.TidList[i]
			binary.BigEndian.PutUint64(data[0:], uint64((*a).UnfinishedTID))
			data = data[8:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1079
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1080

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1081
func (p *AnswerUnfinishedTransactions) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1082
	var nread0 uint32
1083 1084 1085
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1086
	p.MaxTID = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1087
	{
1088 1089 1090
		if len(data) < 12 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1091
		l := binary.BigEndian.Uint32(data[8:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1092
		data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1093
		nread0 += 12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1094
		p.TidList = make([]struct{ UnfinishedTID Tid }, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1095
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1096
			a := &p.TidList[i]
1097 1098 1099
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1100
			(*a).UnfinishedTID = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1101
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1102
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1103 1104
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1105
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1106 1107 1108

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1109 1110
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1111
// 27. LockedTransactions
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1112

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1113
func (p *LockedTransactions) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1114
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1115 1116
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1117
func (p *LockedTransactions) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1118
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1119

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1120
func (p *LockedTransactions) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1121
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1122
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1123

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1124
// 28. AnswerLockedTransactions
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1125

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1126
func (p *AnswerLockedTransactions) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1127
	return 4 + len(p.TidDict)*16
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1128 1129
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1130
func (p *AnswerLockedTransactions) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1131 1132 1133 1134
	{
		l := uint32(len(p.TidDict))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
1135 1136 1137 1138 1139 1140
		keyv := make([]Tid, 0, l)
		for key := range p.TidDict {
			keyv = append(keyv, key)
		}
		sort.Slice(keyv, func(i, j int) bool { return keyv[i] < keyv[j] })
		for _, key := range keyv {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1141
			binary.BigEndian.PutUint64(data[0:], uint64(key))
1142
			binary.BigEndian.PutUint64(data[8:], uint64(p.TidDict[key]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1143 1144 1145
			data = data[16:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1146
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1147

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1148
func (p *AnswerLockedTransactions) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1149
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1150
	{
1151 1152 1153
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1154
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1155
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1156
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1157
		p.TidDict = make(map[Tid]Tid, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1158
		m := p.TidDict
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1159
		for i := 0; uint32(i) < l; i++ {
1160 1161 1162
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1163
			key := Tid(binary.BigEndian.Uint64(data[0:]))
1164 1165 1166
			if len(data) < 16 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1167
			m[key] = Tid(binary.BigEndian.Uint64(data[8:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1168
			data = data[16:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1169
			nread0 += 16
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1170 1171
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1172
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1173 1174 1175

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1176
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1177

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1178
// 29. FinalTID
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1179

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1180
func (p *FinalTID) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1181
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1182 1183
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1184
func (p *FinalTID) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1185 1186
	binary.BigEndian.PutUint64(data[0:], uint64(p.TTID))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1187

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1188
func (p *FinalTID) NEODecode(data []byte) (int, error) {
1189 1190 1191
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1192
	p.TTID = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1193
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1194 1195 1196

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1197 1198
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1199
// 30. AnswerFinalTID
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1200

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1201
func (p *AnswerFinalTID) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1202
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1203 1204
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1205
func (p *AnswerFinalTID) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1206 1207
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1208

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1209
func (p *AnswerFinalTID) NEODecode(data []byte) (int, error) {
1210 1211 1212
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1213
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1214
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1215 1216 1217

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1218 1219
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1220
// 31. ValidateTransaction
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1221

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1222
func (p *ValidateTransaction) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1223
	return 16
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1224 1225
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1226
func (p *ValidateTransaction) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1227 1228 1229
	binary.BigEndian.PutUint64(data[0:], uint64(p.TTID))
	binary.BigEndian.PutUint64(data[8:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1230

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1231
func (p *ValidateTransaction) NEODecode(data []byte) (int, error) {
1232 1233 1234
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1235
	p.TTID = Tid(binary.BigEndian.Uint64(data[0:]))
1236 1237 1238
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1239
	p.Tid = Tid(binary.BigEndian.Uint64(data[8:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1240
	return 16, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1241 1242 1243

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1244 1245
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1246
// 32. BeginTransaction
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1247

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1248
func (p *BeginTransaction) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1249
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1250 1251
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1252
func (p *BeginTransaction) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1253 1254
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1255

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1256
func (p *BeginTransaction) NEODecode(data []byte) (int, error) {
1257 1258 1259
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1260
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1261
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1262 1263 1264

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1265 1266
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1267
// 33. AnswerBeginTransaction
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1268

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1269
func (p *AnswerBeginTransaction) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1270
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1271 1272
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1273
func (p *AnswerBeginTransaction) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1274 1275
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1276

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1277
func (p *AnswerBeginTransaction) NEODecode(data []byte) (int, error) {
1278 1279 1280
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1281
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1282
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1283 1284 1285

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1286
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1287

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1288
// 34. FinishTransaction
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1289

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1290
func (p *FinishTransaction) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1291
	return 16 + len(p.OIDList)*8 + len(p.CheckedList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1292 1293
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1294
func (p *FinishTransaction) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1295
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315
	{
		l := uint32(len(p.OIDList))
		binary.BigEndian.PutUint32(data[8:], l)
		data = data[12:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.OIDList[i]
			binary.BigEndian.PutUint64(data[0:], uint64((*a)))
			data = data[8:]
		}
	}
	{
		l := uint32(len(p.CheckedList))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.CheckedList[i]
			binary.BigEndian.PutUint64(data[0:], uint64((*a)))
			data = data[8:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1316
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1317

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1318
func (p *FinishTransaction) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1319
	var nread0 uint32
1320 1321 1322
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1323
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1324
	{
1325 1326 1327
		if len(data) < 12 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1328
		l := binary.BigEndian.Uint32(data[8:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1329
		data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1330
		nread0 += 12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1331
		p.OIDList = make([]Oid, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1332
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1333
			a := &p.OIDList[i]
1334 1335 1336
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1337
			(*a) = Oid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1338
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1339
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1340 1341 1342
		}
	}
	{
1343 1344 1345
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1346
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1347
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1348
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1349
		p.CheckedList = make([]Oid, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1350
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1351
			a := &p.CheckedList[i]
1352 1353 1354
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1355
			(*a) = Oid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1356
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1357
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1358 1359
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1360
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1361 1362 1363

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1364
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1365

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1366
// 35. AnswerFinishTransaction
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1367

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1368
func (p *AnswerFinishTransaction) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1369
	return 16
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1370 1371
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1372
func (p *AnswerFinishTransaction) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1373 1374 1375
	binary.BigEndian.PutUint64(data[0:], uint64(p.TTID))
	binary.BigEndian.PutUint64(data[8:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1376

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1377
func (p *AnswerFinishTransaction) NEODecode(data []byte) (int, error) {
1378 1379 1380
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1381
	p.TTID = Tid(binary.BigEndian.Uint64(data[0:]))
1382 1383 1384
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1385
	p.Tid = Tid(binary.BigEndian.Uint64(data[8:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1386
	return 16, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1387 1388 1389

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1390 1391
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1392
// 36. NotifyTransactionFinished
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1393

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1394
func (p *NotifyTransactionFinished) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1395
	return 16
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1396 1397
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1398
func (p *NotifyTransactionFinished) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1399 1400 1401
	binary.BigEndian.PutUint64(data[0:], uint64(p.TTID))
	binary.BigEndian.PutUint64(data[8:], uint64(p.MaxTID))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1402

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1403
func (p *NotifyTransactionFinished) NEODecode(data []byte) (int, error) {
1404 1405 1406
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1407
	p.TTID = Tid(binary.BigEndian.Uint64(data[0:]))
1408 1409 1410
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1411
	p.MaxTID = Tid(binary.BigEndian.Uint64(data[8:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1412
	return 16, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1413 1414 1415

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1416 1417
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1418
// 37. LockInformation
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1419

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1420
func (p *LockInformation) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1421
	return 16
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1422 1423
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1424
func (p *LockInformation) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1425 1426 1427
	binary.BigEndian.PutUint64(data[0:], uint64(p.Ttid))
	binary.BigEndian.PutUint64(data[8:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1428

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1429
func (p *LockInformation) NEODecode(data []byte) (int, error) {
1430 1431 1432
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1433
	p.Ttid = Tid(binary.BigEndian.Uint64(data[0:]))
1434 1435 1436
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1437
	p.Tid = Tid(binary.BigEndian.Uint64(data[8:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1438
	return 16, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1439 1440 1441

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1442 1443
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1444
// 38. AnswerLockInformation
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1445

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1446
func (p *AnswerLockInformation) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1447
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1448 1449
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1450
func (p *AnswerLockInformation) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1451 1452
	binary.BigEndian.PutUint64(data[0:], uint64(p.Ttid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1453

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1454
func (p *AnswerLockInformation) NEODecode(data []byte) (int, error) {
1455 1456 1457
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1458
	p.Ttid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1459
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1460 1461 1462

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1463 1464
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1465
// 39. InvalidateObjects
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1466

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1467
func (p *InvalidateObjects) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1468
	return 12 + len(p.OidList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1469 1470
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1471
func (p *InvalidateObjects) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1472
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1473 1474 1475 1476 1477 1478 1479 1480 1481 1482
	{
		l := uint32(len(p.OidList))
		binary.BigEndian.PutUint32(data[8:], l)
		data = data[12:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.OidList[i]
			binary.BigEndian.PutUint64(data[0:], uint64((*a)))
			data = data[8:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1483
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1484

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1485
func (p *InvalidateObjects) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1486
	var nread0 uint32
1487 1488 1489
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1490
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1491
	{
1492 1493 1494
		if len(data) < 12 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1495
		l := binary.BigEndian.Uint32(data[8:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1496
		data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1497
		nread0 += 12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1498
		p.OidList = make([]Oid, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1499
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1500
			a := &p.OidList[i]
1501 1502 1503
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1504
			(*a) = Oid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1505
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1506
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1507 1508
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1509
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1510 1511 1512

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1513 1514
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1515
// 40. UnlockInformation
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1516

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1517
func (p *UnlockInformation) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1518
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1519 1520
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1521
func (p *UnlockInformation) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1522 1523
	binary.BigEndian.PutUint64(data[0:], uint64(p.TTID))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1524

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1525
func (p *UnlockInformation) NEODecode(data []byte) (int, error) {
1526 1527 1528
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1529
	p.TTID = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1530
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1531 1532 1533

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1534 1535
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1536
// 41. GenerateOIDs
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1537

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1538
func (p *GenerateOIDs) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1539
	return 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1540 1541
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1542
func (p *GenerateOIDs) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1543 1544
	binary.BigEndian.PutUint32(data[0:], p.NumOIDs)
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1545

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1546
func (p *GenerateOIDs) NEODecode(data []byte) (int, error) {
1547 1548 1549
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1550
	p.NumOIDs = binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1551
	return 4, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1552 1553 1554

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1555 1556
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1557
// 42. AnswerGenerateOIDs
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1558

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1559
func (p *AnswerGenerateOIDs) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1560
	return 4 + len(p.OidList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1561 1562
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573
func (p *AnswerGenerateOIDs) NEOEncode(data []byte) {
	{
		l := uint32(len(p.OidList))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.OidList[i]
			binary.BigEndian.PutUint64(data[0:], uint64((*a)))
			data = data[8:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1574
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1575

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1576
func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1577
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1578
	{
1579 1580 1581
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1582
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1583
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1584
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1585
		p.OidList = make([]Oid, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1586
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1587
			a := &p.OidList[i]
1588 1589 1590
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1591
			(*a) = Oid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1592
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1593
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1594 1595
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1596
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1597 1598 1599

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1600
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1601

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1602
// 43. StoreObject
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1603

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1604
func (p *StoreObject) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1605
	return 58 + len(p.Data)*1
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1606 1607
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1608
func (p *StoreObject) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631
	binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
	binary.BigEndian.PutUint64(data[8:], uint64(p.Serial))
	(data[16:])[0] = bool2byte(p.Compression)
	(data[17:])[0] = p.Checksum[0]
	(data[18:])[0] = p.Checksum[1]
	(data[19:])[0] = p.Checksum[2]
	(data[20:])[0] = p.Checksum[3]
	(data[21:])[0] = p.Checksum[4]
	(data[22:])[0] = p.Checksum[5]
	(data[23:])[0] = p.Checksum[6]
	(data[24:])[0] = p.Checksum[7]
	(data[25:])[0] = p.Checksum[8]
	(data[26:])[0] = p.Checksum[9]
	(data[27:])[0] = p.Checksum[10]
	(data[28:])[0] = p.Checksum[11]
	(data[29:])[0] = p.Checksum[12]
	(data[30:])[0] = p.Checksum[13]
	(data[31:])[0] = p.Checksum[14]
	(data[32:])[0] = p.Checksum[15]
	(data[33:])[0] = p.Checksum[16]
	(data[34:])[0] = p.Checksum[17]
	(data[35:])[0] = p.Checksum[18]
	(data[36:])[0] = p.Checksum[19]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644
	{
		l := uint32(len(p.Data))
		binary.BigEndian.PutUint32(data[37:], l)
		data = data[41:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.Data[i]
			(data[0:])[0] = (*a)
			data = data[1:]
		}
	}
	binary.BigEndian.PutUint64(data[0:], uint64(p.DataSerial))
	binary.BigEndian.PutUint64(data[8:], uint64(p.Tid))
	(data[16:])[0] = bool2byte(p.Unlock)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1645
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1646

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1647
func (p *StoreObject) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1648
	var nread0 uint32
1649 1650 1651
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1652
	p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
1653 1654 1655
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1656
	p.Serial = Tid(binary.BigEndian.Uint64(data[8:]))
1657 1658 1659
	if len(data) < 17 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1660
	p.Compression = byte2bool((data[16:])[0])
1661 1662 1663
	if len(data) < 18 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1664
	p.Checksum[0] = (data[17:])[0]
1665 1666 1667
	if len(data) < 19 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1668
	p.Checksum[1] = (data[18:])[0]
1669 1670 1671
	if len(data) < 20 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1672
	p.Checksum[2] = (data[19:])[0]
1673 1674 1675
	if len(data) < 21 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1676
	p.Checksum[3] = (data[20:])[0]
1677 1678 1679
	if len(data) < 22 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1680
	p.Checksum[4] = (data[21:])[0]
1681 1682 1683
	if len(data) < 23 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1684
	p.Checksum[5] = (data[22:])[0]
1685 1686 1687
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1688
	p.Checksum[6] = (data[23:])[0]
1689 1690 1691
	if len(data) < 25 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1692
	p.Checksum[7] = (data[24:])[0]
1693 1694 1695
	if len(data) < 26 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1696
	p.Checksum[8] = (data[25:])[0]
1697 1698 1699
	if len(data) < 27 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1700
	p.Checksum[9] = (data[26:])[0]
1701 1702 1703
	if len(data) < 28 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1704
	p.Checksum[10] = (data[27:])[0]
1705 1706 1707
	if len(data) < 29 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1708
	p.Checksum[11] = (data[28:])[0]
1709 1710 1711
	if len(data) < 30 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1712
	p.Checksum[12] = (data[29:])[0]
1713 1714 1715
	if len(data) < 31 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1716
	p.Checksum[13] = (data[30:])[0]
1717 1718 1719
	if len(data) < 32 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1720
	p.Checksum[14] = (data[31:])[0]
1721 1722 1723
	if len(data) < 33 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1724
	p.Checksum[15] = (data[32:])[0]
1725 1726 1727
	if len(data) < 34 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1728
	p.Checksum[16] = (data[33:])[0]
1729 1730 1731
	if len(data) < 35 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1732
	p.Checksum[17] = (data[34:])[0]
1733 1734 1735
	if len(data) < 36 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1736
	p.Checksum[18] = (data[35:])[0]
1737 1738 1739
	if len(data) < 37 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1740 1741
	p.Checksum[19] = (data[36:])[0]
	{
1742 1743 1744
		if len(data) < 41 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1745
		l := binary.BigEndian.Uint32(data[37:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1746
		data = data[41:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1747
		nread0 += 41
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1748
		p.Data = make([]byte, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1749
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1750
			a := &p.Data[i]
1751 1752 1753
			if len(data) < 1 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1754
			(*a) = (data[0:])[0]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1755
			data = data[1:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1756
			nread0 += 1
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1757 1758
		}
	}
1759 1760 1761
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1762
	p.DataSerial = Tid(binary.BigEndian.Uint64(data[0:]))
1763 1764 1765
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1766
	p.Tid = Tid(binary.BigEndian.Uint64(data[8:]))
1767 1768 1769
	if len(data) < 17 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1770
	p.Unlock = byte2bool((data[16:])[0])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1771
	return 17 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1772 1773 1774

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1775
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1776

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1777
// 44. AnswerStoreObject
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1778

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1779
func (p *AnswerStoreObject) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1780
	return 17
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1781 1782
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1783
func (p *AnswerStoreObject) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1784 1785 1786 1787
	(data[0:])[0] = bool2byte(p.Conflicting)
	binary.BigEndian.PutUint64(data[1:], uint64(p.Oid))
	binary.BigEndian.PutUint64(data[9:], uint64(p.Serial))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1788

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1789
func (p *AnswerStoreObject) NEODecode(data []byte) (int, error) {
1790 1791 1792
	if len(data) < 1 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1793
	p.Conflicting = byte2bool((data[0:])[0])
1794 1795 1796
	if len(data) < 9 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1797
	p.Oid = Oid(binary.BigEndian.Uint64(data[1:]))
1798 1799 1800
	if len(data) < 17 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1801
	p.Serial = Tid(binary.BigEndian.Uint64(data[9:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1802
	return 17, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1803 1804 1805

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1806 1807
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1808
// 45. AbortTransaction
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1809

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1810
func (p *AbortTransaction) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1811
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1812 1813
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1814
func (p *AbortTransaction) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1815 1816
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1817

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1818
func (p *AbortTransaction) NEODecode(data []byte) (int, error) {
1819 1820 1821
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1822
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1823
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1824 1825 1826

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1827
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1828

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1829
// 46. StoreTransaction
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1830

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1831
func (p *StoreTransaction) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1832
	return 24 + len(p.User) + len(p.Description) + len(p.Extension) + len(p.OidList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1833 1834
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1835
func (p *StoreTransaction) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1836
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1837 1838 1839 1840 1841
	{
		l := uint32(len(p.User))
		binary.BigEndian.PutUint32(data[8:], l)
		data = data[12:]
		copy(data, p.User)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1842
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1843 1844 1845 1846 1847 1848
	}
	{
		l := uint32(len(p.Description))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		copy(data, p.Description)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1849
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1850 1851 1852 1853 1854 1855
	}
	{
		l := uint32(len(p.Extension))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		copy(data, p.Extension)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1856
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1857
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1858 1859 1860 1861 1862 1863 1864 1865 1866 1867
	{
		l := uint32(len(p.OidList))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.OidList[i]
			binary.BigEndian.PutUint64(data[0:], uint64((*a)))
			data = data[8:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1868
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1869

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1870
func (p *StoreTransaction) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1871
	var nread0 uint32
1872 1873 1874
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1875
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1876
	{
1877 1878 1879
		if len(data) < 12 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1880
		l := binary.BigEndian.Uint32(data[8:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1881
		data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1882
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1883
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1884 1885 1886
		}
		p.User = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1887
		nread0 += 12 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1888 1889
	}
	{
1890 1891 1892
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1893
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1894
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1895
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1896
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1897 1898 1899
		}
		p.Description = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1900
		nread0 += 4 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1901 1902
	}
	{
1903 1904 1905
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1906
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1907
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1908
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1909
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1910 1911 1912
		}
		p.Extension = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1913
		nread0 += 4 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1914 1915
	}
	{
1916 1917 1918
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1919
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1920
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1921
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1922
		p.OidList = make([]Oid, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1923
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1924
			a := &p.OidList[i]
1925 1926 1927
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1928
			(*a) = Oid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1929
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1930
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1931 1932
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1933
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1934 1935 1936

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1937 1938
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1939
// 47. VoteTransaction
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1940

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1941
func (p *VoteTransaction) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1942
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1943 1944
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1945
func (p *VoteTransaction) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1946 1947
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1948

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1949
func (p *VoteTransaction) NEODecode(data []byte) (int, error) {
1950 1951 1952
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1953
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1954
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1955 1956 1957

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1958
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1959

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1960
// 48. GetObject
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1961

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1962
func (p *GetObject) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1963
	return 24
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1964 1965
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1966
func (p *GetObject) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1967 1968 1969 1970
	binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
	binary.BigEndian.PutUint64(data[8:], uint64(p.Serial))
	binary.BigEndian.PutUint64(data[16:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1971

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1972
func (p *GetObject) NEODecode(data []byte) (int, error) {
1973 1974 1975
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1976
	p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
1977 1978 1979
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1980
	p.Serial = Tid(binary.BigEndian.Uint64(data[8:]))
1981 1982 1983
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1984
	p.Tid = Tid(binary.BigEndian.Uint64(data[16:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1985
	return 24, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1986 1987 1988

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1989
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1990

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1991
// 49. AnswerGetObject
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1992

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1993
func (p *AnswerGetObject) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1994
	return 57 + len(p.Data)*1
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1995 1996
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1997
func (p *AnswerGetObject) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021
	binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
	binary.BigEndian.PutUint64(data[8:], uint64(p.SerialStart))
	binary.BigEndian.PutUint64(data[16:], uint64(p.SerialEnd))
	(data[24:])[0] = bool2byte(p.Compression)
	(data[25:])[0] = p.Checksum[0]
	(data[26:])[0] = p.Checksum[1]
	(data[27:])[0] = p.Checksum[2]
	(data[28:])[0] = p.Checksum[3]
	(data[29:])[0] = p.Checksum[4]
	(data[30:])[0] = p.Checksum[5]
	(data[31:])[0] = p.Checksum[6]
	(data[32:])[0] = p.Checksum[7]
	(data[33:])[0] = p.Checksum[8]
	(data[34:])[0] = p.Checksum[9]
	(data[35:])[0] = p.Checksum[10]
	(data[36:])[0] = p.Checksum[11]
	(data[37:])[0] = p.Checksum[12]
	(data[38:])[0] = p.Checksum[13]
	(data[39:])[0] = p.Checksum[14]
	(data[40:])[0] = p.Checksum[15]
	(data[41:])[0] = p.Checksum[16]
	(data[42:])[0] = p.Checksum[17]
	(data[43:])[0] = p.Checksum[18]
	(data[44:])[0] = p.Checksum[19]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032
	{
		l := uint32(len(p.Data))
		binary.BigEndian.PutUint32(data[45:], l)
		data = data[49:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.Data[i]
			(data[0:])[0] = (*a)
			data = data[1:]
		}
	}
	binary.BigEndian.PutUint64(data[0:], uint64(p.DataSerial))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2033
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2034

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2035
func (p *AnswerGetObject) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2036
	var nread0 uint32
2037 2038 2039
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2040
	p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
2041 2042 2043
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2044
	p.SerialStart = Tid(binary.BigEndian.Uint64(data[8:]))
2045 2046 2047
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2048
	p.SerialEnd = Tid(binary.BigEndian.Uint64(data[16:]))
2049 2050 2051
	if len(data) < 25 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2052
	p.Compression = byte2bool((data[24:])[0])
2053 2054 2055
	if len(data) < 26 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2056
	p.Checksum[0] = (data[25:])[0]
2057 2058 2059
	if len(data) < 27 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2060
	p.Checksum[1] = (data[26:])[0]
2061 2062 2063
	if len(data) < 28 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2064
	p.Checksum[2] = (data[27:])[0]
2065 2066 2067
	if len(data) < 29 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2068
	p.Checksum[3] = (data[28:])[0]
2069 2070 2071
	if len(data) < 30 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2072
	p.Checksum[4] = (data[29:])[0]
2073 2074 2075
	if len(data) < 31 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2076
	p.Checksum[5] = (data[30:])[0]
2077 2078 2079
	if len(data) < 32 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2080
	p.Checksum[6] = (data[31:])[0]
2081 2082 2083
	if len(data) < 33 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2084
	p.Checksum[7] = (data[32:])[0]
2085 2086 2087
	if len(data) < 34 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2088
	p.Checksum[8] = (data[33:])[0]
2089 2090 2091
	if len(data) < 35 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2092
	p.Checksum[9] = (data[34:])[0]
2093 2094 2095
	if len(data) < 36 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2096
	p.Checksum[10] = (data[35:])[0]
2097 2098 2099
	if len(data) < 37 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2100
	p.Checksum[11] = (data[36:])[0]
2101 2102 2103
	if len(data) < 38 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2104
	p.Checksum[12] = (data[37:])[0]
2105 2106 2107
	if len(data) < 39 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2108
	p.Checksum[13] = (data[38:])[0]
2109 2110 2111
	if len(data) < 40 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2112
	p.Checksum[14] = (data[39:])[0]
2113 2114 2115
	if len(data) < 41 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2116
	p.Checksum[15] = (data[40:])[0]
2117 2118 2119
	if len(data) < 42 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2120
	p.Checksum[16] = (data[41:])[0]
2121 2122 2123
	if len(data) < 43 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2124
	p.Checksum[17] = (data[42:])[0]
2125 2126 2127
	if len(data) < 44 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2128
	p.Checksum[18] = (data[43:])[0]
2129 2130 2131
	if len(data) < 45 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2132 2133
	p.Checksum[19] = (data[44:])[0]
	{
2134 2135 2136
		if len(data) < 49 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2137
		l := binary.BigEndian.Uint32(data[45:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2138
		data = data[49:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2139
		nread0 += 49
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2140
		p.Data = make([]byte, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2141
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2142
			a := &p.Data[i]
2143 2144 2145
			if len(data) < 1 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2146
			(*a) = (data[0:])[0]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2147
			data = data[1:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2148
			nread0 += 1
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2149 2150
		}
	}
2151 2152 2153
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2154
	p.DataSerial = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2155
	return 8 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2156 2157 2158

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2159
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2160

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2161
// 50. TIDList
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2162

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2163
func (p *TIDList) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2164
	return 20
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2165 2166
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2167
func (p *TIDList) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2168 2169 2170 2171
	binary.BigEndian.PutUint64(data[0:], p.First)
	binary.BigEndian.PutUint64(data[8:], p.Last)
	binary.BigEndian.PutUint32(data[16:], p.Partition)
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2172

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2173
func (p *TIDList) NEODecode(data []byte) (int, error) {
2174 2175 2176
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2177
	p.First = binary.BigEndian.Uint64(data[0:])
2178 2179 2180
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2181
	p.Last = binary.BigEndian.Uint64(data[8:])
2182 2183 2184
	if len(data) < 20 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2185
	p.Partition = binary.BigEndian.Uint32(data[16:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2186
	return 20, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2187 2188 2189

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2190 2191
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2192
// 51. AnswerTIDList
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2193

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2194
func (p *AnswerTIDList) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2195
	return 4 + len(p.TIDList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2196 2197
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208
func (p *AnswerTIDList) NEOEncode(data []byte) {
	{
		l := uint32(len(p.TIDList))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.TIDList[i]
			binary.BigEndian.PutUint64(data[0:], uint64((*a)))
			data = data[8:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2209
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2210

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2211
func (p *AnswerTIDList) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2212
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2213
	{
2214 2215 2216
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2217
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2218
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2219
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2220
		p.TIDList = make([]Tid, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2221
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2222
			a := &p.TIDList[i]
2223 2224 2225
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2226
			(*a) = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2227
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2228
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2229 2230
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2231
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2232 2233 2234

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2235 2236
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2237
// 52. TIDListFrom
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2238

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2239
func (p *TIDListFrom) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2240
	return 24
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2241 2242
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2243
func (p *TIDListFrom) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2244 2245 2246 2247 2248
	binary.BigEndian.PutUint64(data[0:], uint64(p.MinTID))
	binary.BigEndian.PutUint64(data[8:], uint64(p.MaxTID))
	binary.BigEndian.PutUint32(data[16:], p.Length)
	binary.BigEndian.PutUint32(data[20:], p.Partition)
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2249

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2250
func (p *TIDListFrom) NEODecode(data []byte) (int, error) {
2251 2252 2253
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2254
	p.MinTID = Tid(binary.BigEndian.Uint64(data[0:]))
2255 2256 2257
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2258
	p.MaxTID = Tid(binary.BigEndian.Uint64(data[8:]))
2259 2260 2261
	if len(data) < 20 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2262
	p.Length = binary.BigEndian.Uint32(data[16:])
2263 2264 2265
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2266
	p.Partition = binary.BigEndian.Uint32(data[20:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2267
	return 24, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2268 2269 2270

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2271 2272
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2273
// 53. AnswerTIDListFrom
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2274

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2275
func (p *AnswerTIDListFrom) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2276
	return 4 + len(p.TidList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2277 2278
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289
func (p *AnswerTIDListFrom) NEOEncode(data []byte) {
	{
		l := uint32(len(p.TidList))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.TidList[i]
			binary.BigEndian.PutUint64(data[0:], uint64((*a)))
			data = data[8:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2290
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2291

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2292
func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2293
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2294
	{
2295 2296 2297
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2298
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2299
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2300
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2301
		p.TidList = make([]Tid, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2302
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2303
			a := &p.TidList[i]
2304 2305 2306
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2307
			(*a) = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2308
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2309
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2310 2311
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2312
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2313 2314 2315

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2316 2317
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2318
// 54. TransactionInformation
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2319

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2320
func (p *TransactionInformation) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2321
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2322 2323
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2324
func (p *TransactionInformation) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2325 2326
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2327

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2328
func (p *TransactionInformation) NEODecode(data []byte) (int, error) {
2329 2330 2331
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2332
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2333
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2334 2335 2336

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2337 2338
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2339
// 55. AnswerTransactionInformation
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2340

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2341
func (p *AnswerTransactionInformation) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2342
	return 25 + len(p.User) + len(p.Description) + len(p.Extension) + len(p.OidList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2343 2344
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2345
func (p *AnswerTransactionInformation) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2346
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2347 2348 2349 2350 2351
	{
		l := uint32(len(p.User))
		binary.BigEndian.PutUint32(data[8:], l)
		data = data[12:]
		copy(data, p.User)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2352
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2353 2354 2355 2356 2357 2358
	}
	{
		l := uint32(len(p.Description))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		copy(data, p.Description)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2359
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2360 2361 2362 2363 2364 2365
	}
	{
		l := uint32(len(p.Extension))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		copy(data, p.Extension)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2366
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2367 2368
	}
	(data[0:])[0] = bool2byte(p.Packed)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2369 2370 2371 2372 2373 2374 2375 2376 2377 2378
	{
		l := uint32(len(p.OidList))
		binary.BigEndian.PutUint32(data[1:], l)
		data = data[5:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.OidList[i]
			binary.BigEndian.PutUint64(data[0:], uint64((*a)))
			data = data[8:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2379
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2380

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2381
func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2382
	var nread0 uint32
2383 2384 2385
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2386
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2387
	{
2388 2389 2390
		if len(data) < 12 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2391
		l := binary.BigEndian.Uint32(data[8:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2392
		data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2393
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2394
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2395 2396 2397
		}
		p.User = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2398
		nread0 += 12 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2399 2400
	}
	{
2401 2402 2403
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2404
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2405
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2406
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2407
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2408 2409 2410
		}
		p.Description = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2411
		nread0 += 4 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2412 2413
	}
	{
2414 2415 2416
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2417
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2418
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2419
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2420
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2421 2422 2423
		}
		p.Extension = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2424
		nread0 += 4 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2425
	}
2426 2427 2428
	if len(data) < 1 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2429
	p.Packed = byte2bool((data[0:])[0])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2430
	{
2431 2432 2433
		if len(data) < 5 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2434
		l := binary.BigEndian.Uint32(data[1:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2435
		data = data[5:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2436
		nread0 += 5
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2437
		p.OidList = make([]Oid, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2438
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2439
			a := &p.OidList[i]
2440 2441 2442
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2443
			(*a) = Oid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2444
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2445
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2446 2447
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2448
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2449 2450 2451

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2452 2453
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2454
// 56. ObjectHistory
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2455

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2456
func (p *ObjectHistory) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2457
	return 24
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2458 2459
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2460
func (p *ObjectHistory) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2461 2462 2463 2464
	binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
	binary.BigEndian.PutUint64(data[8:], p.First)
	binary.BigEndian.PutUint64(data[16:], p.Last)
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2465

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2466
func (p *ObjectHistory) NEODecode(data []byte) (int, error) {
2467 2468 2469
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2470
	p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
2471 2472 2473
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2474
	p.First = binary.BigEndian.Uint64(data[8:])
2475 2476 2477
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2478
	p.Last = binary.BigEndian.Uint64(data[16:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2479
	return 24, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2480 2481 2482

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2483 2484
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2485
// 57. AnswerObjectHistory
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2486

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2487
func (p *AnswerObjectHistory) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2488
	return 12 + len(p.HistoryList)*12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2489 2490
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2491
func (p *AnswerObjectHistory) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2492
	binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503
	{
		l := uint32(len(p.HistoryList))
		binary.BigEndian.PutUint32(data[8:], l)
		data = data[12:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.HistoryList[i]
			binary.BigEndian.PutUint64(data[0:], uint64((*a).Serial))
			binary.BigEndian.PutUint32(data[8:], (*a).Size)
			data = data[12:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2504
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2505

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2506
func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2507
	var nread0 uint32
2508 2509 2510
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2511
	p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2512
	{
2513 2514 2515
		if len(data) < 12 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2516
		l := binary.BigEndian.Uint32(data[8:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2517
		data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2518
		nread0 += 12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2519
		p.HistoryList = make([]struct {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2520
			Serial Tid
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2521 2522
			Size   uint32
		}, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2523
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2524
			a := &p.HistoryList[i]
2525 2526 2527
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2528
			(*a).Serial = Tid(binary.BigEndian.Uint64(data[0:]))
2529 2530 2531
			if len(data) < 12 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2532
			(*a).Size = binary.BigEndian.Uint32(data[8:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2533
			data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2534
			nread0 += 12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2535 2536
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2537
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2538 2539 2540

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2541
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2542

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2543
// 58. PartitionList
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2544

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2545
func (p *PartitionList) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2546
	return 12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2547 2548
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2549
func (p *PartitionList) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2550 2551 2552 2553
	binary.BigEndian.PutUint32(data[0:], p.MinOffset)
	binary.BigEndian.PutUint32(data[4:], p.MaxOffset)
	binary.BigEndian.PutUint32(data[8:], uint32(int32(p.UUID)))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2554

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2555
func (p *PartitionList) NEODecode(data []byte) (int, error) {
2556 2557 2558
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2559
	p.MinOffset = binary.BigEndian.Uint32(data[0:])
2560 2561 2562
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2563
	p.MaxOffset = binary.BigEndian.Uint32(data[4:])
2564 2565 2566
	if len(data) < 12 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2567
	p.UUID = UUID(int32(binary.BigEndian.Uint32(data[8:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2568
	return 12, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2569 2570 2571

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2572 2573
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2574
// 59. AnswerPartitionList
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2575

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2576
func (p *AnswerPartitionList) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2577
	var size0 int
Kirill Smelkov's avatar
Kirill Smelkov committed
2578 2579
	for i := 0; i < len(p.RowList); i++ {
		a := &p.RowList[i]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2580

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2581
		size0 += 8 + len((*a).CellList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2582
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2583
	return 12 + size0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2584 2585
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2586
func (p *AnswerPartitionList) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2587
	binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608
	{
		l := uint32(len(p.RowList))
		binary.BigEndian.PutUint32(data[8:], l)
		data = data[12:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.RowList[i]
			binary.BigEndian.PutUint32(data[0:], (*a).Offset)
			{
				l := uint32(len((*a).CellList))
				binary.BigEndian.PutUint32(data[4:], l)
				data = data[8:]
				for i := 0; uint32(i) < l; i++ {
					a := &(*a).CellList[i]
					binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).UUID)))
					binary.BigEndian.PutUint32(data[4:], uint32(int32((*a).CellState)))
					data = data[8:]
				}
			}
			data = data[0:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2609
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2610

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2611
func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2612
	var nread0 uint32
2613 2614 2615
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2616
	p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2617
	{
2618 2619 2620
		if len(data) < 12 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2621
		l := binary.BigEndian.Uint32(data[8:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2622
		data = data[12:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2623
		nread0 += 12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2624
		p.RowList = make([]RowInfo, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2625
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2626
			a := &p.RowList[i]
2627 2628 2629
			if len(data) < 4 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2630
			(*a).Offset = binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2631
			{
2632 2633 2634
				if len(data) < 8 {
					goto overflow
				}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2635
				l := binary.BigEndian.Uint32(data[4:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2636
				data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2637
				nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2638
				(*a).CellList = make([]CellInfo, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2639
				for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2640
					a := &(*a).CellList[i]
2641 2642 2643
					if len(data) < 4 {
						goto overflow
					}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2644
					(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
2645 2646 2647
					if len(data) < 8 {
						goto overflow
					}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2648
					(*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2649
					data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2650
					nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2651 2652 2653
				}
			}
			data = data[0:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2654
			nread0 += 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2655 2656
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2657
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2658 2659 2660

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2661 2662
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2663
// 60. X_NodeList
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2664

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2665
func (p *X_NodeList) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2666
	return 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2667 2668
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2669
func (p *X_NodeList) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2670 2671
	binary.BigEndian.PutUint32(data[0:], uint32(int32(p.NodeType)))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2672

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2673
func (p *X_NodeList) NEODecode(data []byte) (int, error) {
2674 2675 2676
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2677
	p.NodeType = NodeType(int32(binary.BigEndian.Uint32(data[0:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2678
	return 4, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2679 2680 2681

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2682 2683
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2684
// 61. AnswerNodeList
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2685

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2686
func (p *AnswerNodeList) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2687
	var size0 int
Kirill Smelkov's avatar
Kirill Smelkov committed
2688 2689
	for i := 0; i < len(p.NodeList); i++ {
		a := &p.NodeList[i]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2690

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2691
		size0 += 26 + len((*a).Address.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2692
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2693
	return 4 + size0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2694 2695
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708
func (p *AnswerNodeList) NEOEncode(data []byte) {
	{
		l := uint32(len(p.NodeList))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.NodeList[i]
			binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).NodeType)))
			{
				l := uint32(len((*a).Address.Host))
				binary.BigEndian.PutUint32(data[4:], l)
				data = data[8:]
				copy(data, (*a).Address.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2709
				data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2710 2711 2712 2713 2714 2715 2716 2717
			}
			binary.BigEndian.PutUint16(data[0:], (*a).Address.Port)
			binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID)))
			binary.BigEndian.PutUint32(data[6:], uint32(int32((*a).NodeState)))
			float64_NEOEncode(data[10:], (*a).IdTimestamp)
			data = data[18:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2718
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2719

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2720
func (p *AnswerNodeList) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2721
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2722
	{
2723 2724 2725
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2726
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2727
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2728
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2729
		p.NodeList = make([]NodeInfo, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2730
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2731
			a := &p.NodeList[i]
2732 2733 2734
			if len(data) < 4 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2735
			(*a).NodeType = NodeType(int32(binary.BigEndian.Uint32(data[0:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2736
			{
2737 2738 2739
				if len(data) < 8 {
					goto overflow
				}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2740
				l := binary.BigEndian.Uint32(data[4:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2741
				data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2742
				if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2743
					goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2744
				}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2745
				(*a).Address.Host = string(data[:l])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2746
				data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2747
				nread0 += 8 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2748
			}
2749 2750 2751
			if len(data) < 2 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2752
			(*a).Address.Port = binary.BigEndian.Uint16(data[0:])
2753 2754 2755
			if len(data) < 6 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2756
			(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[2:])))
2757 2758 2759
			if len(data) < 10 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2760
			(*a).NodeState = NodeState(int32(binary.BigEndian.Uint32(data[6:])))
2761 2762 2763
			if len(data) < 18 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2764
			(*a).IdTimestamp = float64_NEODecode(data[10:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2765
			data = data[18:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2766
			nread0 += 18
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2767 2768
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2769
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2770 2771 2772

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2773 2774
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2775
// 62. SetNodeState
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2776

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2777
func (p *SetNodeState) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2778
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2779 2780
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2781
func (p *SetNodeState) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2782 2783 2784
	binary.BigEndian.PutUint32(data[0:], uint32(int32(p.UUID)))
	binary.BigEndian.PutUint32(data[4:], uint32(int32(p.NodeState)))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2785

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2786
func (p *SetNodeState) NEODecode(data []byte) (int, error) {
2787 2788 2789
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2790
	p.UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
2791 2792 2793
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2794
	p.NodeState = NodeState(int32(binary.BigEndian.Uint32(data[4:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2795
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2796 2797 2798

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2799 2800
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2801
// 63. AddPendingNodes
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2802

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2803
func (p *AddPendingNodes) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2804
	return 4 + len(p.UUIDList)*4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2805 2806
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817
func (p *AddPendingNodes) NEOEncode(data []byte) {
	{
		l := uint32(len(p.UUIDList))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.UUIDList[i]
			binary.BigEndian.PutUint32(data[0:], uint32(int32((*a))))
			data = data[4:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2818
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2819

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2820
func (p *AddPendingNodes) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2821
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2822
	{
2823 2824 2825
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2826
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2827
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2828
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2829
		p.UUIDList = make([]UUID, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2830
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2831
			a := &p.UUIDList[i]
2832 2833 2834
			if len(data) < 4 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2835
			(*a) = UUID(int32(binary.BigEndian.Uint32(data[0:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2836
			data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2837
			nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2838 2839
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2840
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2841 2842 2843

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2844 2845
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2846
// 64. TweakPartitionTable
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2847

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2848
func (p *TweakPartitionTable) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2849
	return 4 + len(p.UUIDList)*4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2850 2851
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862
func (p *TweakPartitionTable) NEOEncode(data []byte) {
	{
		l := uint32(len(p.UUIDList))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.UUIDList[i]
			binary.BigEndian.PutUint32(data[0:], uint32(int32((*a))))
			data = data[4:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2863
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2864

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2865
func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2866
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2867
	{
2868 2869 2870
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2871
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2872
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2873
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2874
		p.UUIDList = make([]UUID, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2875
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2876
			a := &p.UUIDList[i]
2877 2878 2879
			if len(data) < 4 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2880
			(*a) = UUID(int32(binary.BigEndian.Uint32(data[0:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2881
			data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2882
			nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2883 2884
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2885
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2886 2887 2888

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2889 2890
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2891
// 65. NotifyNodeInformation
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2892

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2893
func (p *NotifyNodeInformation) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2894
	var size0 int
Kirill Smelkov's avatar
Kirill Smelkov committed
2895 2896
	for i := 0; i < len(p.NodeList); i++ {
		a := &p.NodeList[i]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2897

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2898
		size0 += 26 + len((*a).Address.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2899
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2900
	return 4 + size0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2901 2902
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915
func (p *NotifyNodeInformation) NEOEncode(data []byte) {
	{
		l := uint32(len(p.NodeList))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.NodeList[i]
			binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).NodeType)))
			{
				l := uint32(len((*a).Address.Host))
				binary.BigEndian.PutUint32(data[4:], l)
				data = data[8:]
				copy(data, (*a).Address.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2916
				data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2917 2918 2919 2920 2921 2922 2923 2924
			}
			binary.BigEndian.PutUint16(data[0:], (*a).Address.Port)
			binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID)))
			binary.BigEndian.PutUint32(data[6:], uint32(int32((*a).NodeState)))
			float64_NEOEncode(data[10:], (*a).IdTimestamp)
			data = data[18:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2925
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2926

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2927
func (p *NotifyNodeInformation) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2928
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2929
	{
2930 2931 2932
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2933
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2934
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2935
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2936
		p.NodeList = make([]NodeInfo, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2937
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2938
			a := &p.NodeList[i]
2939 2940 2941
			if len(data) < 4 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2942
			(*a).NodeType = NodeType(int32(binary.BigEndian.Uint32(data[0:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2943
			{
2944 2945 2946
				if len(data) < 8 {
					goto overflow
				}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2947
				l := binary.BigEndian.Uint32(data[4:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2948
				data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2949
				if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2950
					goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2951
				}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2952
				(*a).Address.Host = string(data[:l])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2953
				data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2954
				nread0 += 8 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2955
			}
2956 2957 2958
			if len(data) < 2 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2959
			(*a).Address.Port = binary.BigEndian.Uint16(data[0:])
2960 2961 2962
			if len(data) < 6 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2963
			(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[2:])))
2964 2965 2966
			if len(data) < 10 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2967
			(*a).NodeState = NodeState(int32(binary.BigEndian.Uint32(data[6:])))
2968 2969 2970
			if len(data) < 18 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2971
			(*a).IdTimestamp = float64_NEODecode(data[10:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2972
			data = data[18:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2973
			nread0 += 18
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2974 2975
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2976
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2977 2978 2979

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2980 2981
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2982
// 66. NodeInformation
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2983

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2984
func (p *NodeInformation) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2985
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2986 2987
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2988
func (p *NodeInformation) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2989
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2990

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2991
func (p *NodeInformation) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2992
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2993 2994
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2995
// 67. SetClusterState
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2996

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2997
func (p *SetClusterState) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2998
	return 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
2999 3000
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3001
func (p *SetClusterState) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3002 3003
	binary.BigEndian.PutUint32(data[0:], uint32(int32(p.State)))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3004

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3005
func (p *SetClusterState) NEODecode(data []byte) (int, error) {
3006 3007 3008
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3009
	p.State = ClusterState(int32(binary.BigEndian.Uint32(data[0:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3010
	return 4, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3011 3012 3013

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3014 3015
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3016
// 68. ClusterInformation
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3017

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3018
func (p *ClusterInformation) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3019
	return 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3020 3021
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3022
func (p *ClusterInformation) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3023 3024
	binary.BigEndian.PutUint32(data[0:], uint32(int32(p.State)))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3025

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3026
func (p *ClusterInformation) NEODecode(data []byte) (int, error) {
3027 3028 3029
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3030
	p.State = ClusterState(int32(binary.BigEndian.Uint32(data[0:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3031
	return 4, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3032 3033 3034

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3035 3036
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3037
// 69. X_ClusterState
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3038

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3039
func (p *X_ClusterState) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3040
	return 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3041 3042
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3043
func (p *X_ClusterState) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3044 3045
	binary.BigEndian.PutUint32(data[0:], uint32(int32(p.State)))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3046

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3047
func (p *X_ClusterState) NEODecode(data []byte) (int, error) {
3048 3049 3050
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3051
	p.State = ClusterState(int32(binary.BigEndian.Uint32(data[0:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3052
	return 4, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3053 3054 3055

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3056 3057
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3058
// 70. ObjectUndoSerial
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3059

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3060
func (p *ObjectUndoSerial) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3061
	return 28 + len(p.OidList)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3062 3063
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3064
func (p *ObjectUndoSerial) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3065 3066 3067
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
	binary.BigEndian.PutUint64(data[8:], uint64(p.LTID))
	binary.BigEndian.PutUint64(data[16:], uint64(p.UndoneTID))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3068 3069 3070 3071 3072 3073 3074 3075 3076 3077
	{
		l := uint32(len(p.OidList))
		binary.BigEndian.PutUint32(data[24:], l)
		data = data[28:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.OidList[i]
			binary.BigEndian.PutUint64(data[0:], uint64((*a)))
			data = data[8:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3078
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3079

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3080
func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3081
	var nread0 uint32
3082 3083 3084
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3085
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
3086 3087 3088
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3089
	p.LTID = Tid(binary.BigEndian.Uint64(data[8:]))
3090 3091 3092
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3093
	p.UndoneTID = Tid(binary.BigEndian.Uint64(data[16:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3094
	{
3095 3096 3097
		if len(data) < 28 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3098
		l := binary.BigEndian.Uint32(data[24:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3099
		data = data[28:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3100
		nread0 += 28
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3101
		p.OidList = make([]Oid, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3102
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3103
			a := &p.OidList[i]
3104 3105 3106
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3107
			(*a) = Oid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3108
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3109
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3110 3111
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3112
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3113 3114 3115

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3116 3117
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3118
// 71. AnswerObjectUndoSerial
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3119

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3120
func (p *AnswerObjectUndoSerial) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3121
	return 4 + len(p.ObjectTIDDict)*25
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3122 3123
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3124
func (p *AnswerObjectUndoSerial) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3125 3126 3127 3128
	{
		l := uint32(len(p.ObjectTIDDict))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
3129 3130 3131 3132 3133 3134
		keyv := make([]Oid, 0, l)
		for key := range p.ObjectTIDDict {
			keyv = append(keyv, key)
		}
		sort.Slice(keyv, func(i, j int) bool { return keyv[i] < keyv[j] })
		for _, key := range keyv {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3135
			binary.BigEndian.PutUint64(data[0:], uint64(key))
3136 3137 3138
			binary.BigEndian.PutUint64(data[8:], uint64(p.ObjectTIDDict[key].CurrentSerial))
			binary.BigEndian.PutUint64(data[16:], uint64(p.ObjectTIDDict[key].UndoSerial))
			(data[24:])[0] = bool2byte(p.ObjectTIDDict[key].IsCurrent)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3139 3140 3141
			data = data[25:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3142
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3143

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3144
func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3145
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3146
	{
3147 3148 3149
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3150
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3151
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3152
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3153 3154 3155
		p.ObjectTIDDict = make(map[Oid]struct {
			CurrentSerial Tid
			UndoSerial    Tid
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3156 3157 3158
			IsCurrent     bool
		}, l)
		m := p.ObjectTIDDict
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3159
		for i := 0; uint32(i) < l; i++ {
3160 3161 3162
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3163
			key := Oid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3164 3165 3166 3167 3168
			var v struct {
				CurrentSerial Tid
				UndoSerial    Tid
				IsCurrent     bool
			}
3169 3170 3171
			if len(data) < 16 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3172
			v.CurrentSerial = Tid(binary.BigEndian.Uint64(data[8:]))
3173 3174 3175
			if len(data) < 24 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3176
			v.UndoSerial = Tid(binary.BigEndian.Uint64(data[16:]))
3177 3178 3179
			if len(data) < 25 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3180 3181
			v.IsCurrent = byte2bool((data[24:])[0])
			m[key] = v
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3182
			data = data[25:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3183
			nread0 += 25
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3184 3185
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3186
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3187 3188 3189

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3190 3191
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3192
// 72. HasLock
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3193

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3194
func (p *HasLock) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3195
	return 16
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3196 3197
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3198
func (p *HasLock) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3199 3200 3201
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
	binary.BigEndian.PutUint64(data[8:], uint64(p.Oid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3202

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3203
func (p *HasLock) NEODecode(data []byte) (int, error) {
3204 3205 3206
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3207
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
3208 3209 3210
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3211
	p.Oid = Oid(binary.BigEndian.Uint64(data[8:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3212
	return 16, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3213 3214 3215

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3216 3217
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3218
// 73. AnswerHasLock
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3219

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3220
func (p *AnswerHasLock) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3221
	return 12
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3222 3223
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3224
func (p *AnswerHasLock) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3225 3226 3227
	binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
	binary.BigEndian.PutUint32(data[8:], uint32(int32(p.LockState)))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3228

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3229
func (p *AnswerHasLock) NEODecode(data []byte) (int, error) {
3230 3231 3232
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3233
	p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
3234 3235 3236
	if len(data) < 12 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3237
	p.LockState = LockState(int32(binary.BigEndian.Uint32(data[8:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3238
	return 12, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3239 3240 3241

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3242 3243
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3244
// 74. CheckCurrentSerial
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3245

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3246
func (p *CheckCurrentSerial) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3247
	return 24
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3248 3249
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3250
func (p *CheckCurrentSerial) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3251 3252 3253 3254
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
	binary.BigEndian.PutUint64(data[8:], uint64(p.Serial))
	binary.BigEndian.PutUint64(data[16:], uint64(p.Oid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3255

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3256
func (p *CheckCurrentSerial) NEODecode(data []byte) (int, error) {
3257 3258 3259
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3260
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
3261 3262 3263
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3264
	p.Serial = Tid(binary.BigEndian.Uint64(data[8:]))
3265 3266 3267
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3268
	p.Oid = Oid(binary.BigEndian.Uint64(data[16:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3269
	return 24, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3270 3271 3272

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3273 3274
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3275
// 75. AnswerCheckCurrentSerial
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3276

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3277
func (p *AnswerCheckCurrentSerial) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3278
	return 17
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3279 3280
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3281
func (p *AnswerCheckCurrentSerial) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3282 3283 3284 3285
	(data[0:])[0] = bool2byte(p.Conflicting)
	binary.BigEndian.PutUint64(data[1:], uint64(p.Oid))
	binary.BigEndian.PutUint64(data[9:], uint64(p.Serial))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3286

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3287
func (p *AnswerCheckCurrentSerial) NEODecode(data []byte) (int, error) {
3288 3289 3290
	if len(data) < 1 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3291
	p.Conflicting = byte2bool((data[0:])[0])
3292 3293 3294
	if len(data) < 9 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3295
	p.Oid = Oid(binary.BigEndian.Uint64(data[1:]))
3296 3297 3298
	if len(data) < 17 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3299
	p.Serial = Tid(binary.BigEndian.Uint64(data[9:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3300
	return 17, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3301 3302 3303

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3304 3305
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3306
// 76. Pack
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3307

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3308
func (p *Pack) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3309
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3310 3311
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3312
func (p *Pack) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3313 3314
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3315

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3316
func (p *Pack) NEODecode(data []byte) (int, error) {
3317 3318 3319
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3320
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3321
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3322 3323 3324

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3325 3326
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3327
// 77. AnswerPack
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3328

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3329
func (p *AnswerPack) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3330
	return 1
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3331 3332
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3333
func (p *AnswerPack) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3334 3335
	(data[0:])[0] = bool2byte(p.Status)
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3336

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3337
func (p *AnswerPack) NEODecode(data []byte) (int, error) {
3338 3339 3340
	if len(data) < 1 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3341
	p.Status = byte2bool((data[0:])[0])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3342
	return 1, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3343 3344 3345

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3346 3347
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3348
// 78. CheckReplicas
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3349

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3350
func (p *CheckReplicas) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3351
	return 20 + len(p.PartitionDict)*8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3352 3353
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3354
func (p *CheckReplicas) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3355 3356 3357 3358
	{
		l := uint32(len(p.PartitionDict))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
3359 3360 3361 3362 3363 3364
		keyv := make([]uint32, 0, l)
		for key := range p.PartitionDict {
			keyv = append(keyv, key)
		}
		sort.Slice(keyv, func(i, j int) bool { return keyv[i] < keyv[j] })
		for _, key := range keyv {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3365
			binary.BigEndian.PutUint32(data[0:], key)
3366
			binary.BigEndian.PutUint32(data[4:], uint32(int32(p.PartitionDict[key])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3367 3368 3369
			data = data[8:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3370 3371 3372
	binary.BigEndian.PutUint64(data[0:], uint64(p.MinTID))
	binary.BigEndian.PutUint64(data[8:], uint64(p.MaxTID))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3373

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3374
func (p *CheckReplicas) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3375
	var nread0 uint32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3376
	{
3377 3378 3379
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3380
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3381
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3382
		nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3383
		p.PartitionDict = make(map[uint32]UUID, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3384
		m := p.PartitionDict
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3385
		for i := 0; uint32(i) < l; i++ {
3386 3387 3388
			if len(data) < 4 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3389
			key := binary.BigEndian.Uint32(data[0:])
3390 3391 3392
			if len(data) < 8 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3393
			m[key] = UUID(int32(binary.BigEndian.Uint32(data[4:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3394
			data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3395
			nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3396 3397
		}
	}
3398 3399 3400
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3401
	p.MinTID = Tid(binary.BigEndian.Uint64(data[0:]))
3402 3403 3404
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3405
	p.MaxTID = Tid(binary.BigEndian.Uint64(data[8:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3406
	return 16 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3407 3408 3409

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3410 3411
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3412
// 79. CheckPartition
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3413

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3414
func (p *CheckPartition) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3415
	return 30 + len(p.Source.UpstreamName) + len(p.Source.Address.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3416 3417
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3418
func (p *CheckPartition) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3419
	binary.BigEndian.PutUint32(data[0:], p.Partition)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3420 3421 3422 3423 3424
	{
		l := uint32(len(p.Source.UpstreamName))
		binary.BigEndian.PutUint32(data[4:], l)
		data = data[8:]
		copy(data, p.Source.UpstreamName)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3425
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3426 3427 3428 3429 3430 3431
	}
	{
		l := uint32(len(p.Source.Address.Host))
		binary.BigEndian.PutUint32(data[0:], l)
		data = data[4:]
		copy(data, p.Source.Address.Host)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3432
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3433 3434 3435 3436
	}
	binary.BigEndian.PutUint16(data[0:], p.Source.Address.Port)
	binary.BigEndian.PutUint64(data[2:], uint64(p.MinTID))
	binary.BigEndian.PutUint64(data[10:], uint64(p.MaxTID))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3437
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3438

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3439
func (p *CheckPartition) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3440
	var nread0 uint32
3441 3442 3443
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3444
	p.Partition = binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3445
	{
3446 3447 3448
		if len(data) < 8 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3449
		l := binary.BigEndian.Uint32(data[4:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3450
		data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3451
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3452
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3453 3454 3455
		}
		p.Source.UpstreamName = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3456
		nread0 += 8 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3457 3458
	}
	{
3459 3460 3461
		if len(data) < 4 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3462
		l := binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3463
		data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3464
		if uint32(len(data)) < l {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3465
			goto overflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3466 3467 3468
		}
		p.Source.Address.Host = string(data[:l])
		data = data[l:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3469
		nread0 += 4 + l
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3470
	}
3471 3472 3473
	if len(data) < 2 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3474
	p.Source.Address.Port = binary.BigEndian.Uint16(data[0:])
3475 3476 3477
	if len(data) < 10 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3478
	p.MinTID = Tid(binary.BigEndian.Uint64(data[2:]))
3479 3480 3481
	if len(data) < 18 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3482
	p.MaxTID = Tid(binary.BigEndian.Uint64(data[10:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3483
	return 18 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3484 3485 3486

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3487 3488
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3489
// 80. CheckTIDRange
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3490

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3491
func (p *CheckTIDRange) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3492
	return 24
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3493 3494
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3495
func (p *CheckTIDRange) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3496 3497 3498 3499 3500
	binary.BigEndian.PutUint32(data[0:], p.Partition)
	binary.BigEndian.PutUint32(data[4:], p.Length)
	binary.BigEndian.PutUint64(data[8:], uint64(p.MinTID))
	binary.BigEndian.PutUint64(data[16:], uint64(p.MaxTID))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3501

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3502
func (p *CheckTIDRange) NEODecode(data []byte) (int, error) {
3503 3504 3505
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3506
	p.Partition = binary.BigEndian.Uint32(data[0:])
3507 3508 3509
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3510
	p.Length = binary.BigEndian.Uint32(data[4:])
3511 3512 3513
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3514
	p.MinTID = Tid(binary.BigEndian.Uint64(data[8:]))
3515 3516 3517
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3518
	p.MaxTID = Tid(binary.BigEndian.Uint64(data[16:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3519
	return 24, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3520 3521 3522

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3523 3524
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3525
// 81. AnswerCheckTIDRange
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3526

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3527
func (p *AnswerCheckTIDRange) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3528
	return 32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3529 3530
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3531
func (p *AnswerCheckTIDRange) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554
	binary.BigEndian.PutUint32(data[0:], p.Count)
	(data[4:])[0] = p.Checksum[0]
	(data[5:])[0] = p.Checksum[1]
	(data[6:])[0] = p.Checksum[2]
	(data[7:])[0] = p.Checksum[3]
	(data[8:])[0] = p.Checksum[4]
	(data[9:])[0] = p.Checksum[5]
	(data[10:])[0] = p.Checksum[6]
	(data[11:])[0] = p.Checksum[7]
	(data[12:])[0] = p.Checksum[8]
	(data[13:])[0] = p.Checksum[9]
	(data[14:])[0] = p.Checksum[10]
	(data[15:])[0] = p.Checksum[11]
	(data[16:])[0] = p.Checksum[12]
	(data[17:])[0] = p.Checksum[13]
	(data[18:])[0] = p.Checksum[14]
	(data[19:])[0] = p.Checksum[15]
	(data[20:])[0] = p.Checksum[16]
	(data[21:])[0] = p.Checksum[17]
	(data[22:])[0] = p.Checksum[18]
	(data[23:])[0] = p.Checksum[19]
	binary.BigEndian.PutUint64(data[24:], uint64(p.MaxTID))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3555

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3556
func (p *AnswerCheckTIDRange) NEODecode(data []byte) (int, error) {
3557 3558 3559
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3560
	p.Count = binary.BigEndian.Uint32(data[0:])
3561 3562 3563
	if len(data) < 5 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3564
	p.Checksum[0] = (data[4:])[0]
3565 3566 3567
	if len(data) < 6 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3568
	p.Checksum[1] = (data[5:])[0]
3569 3570 3571
	if len(data) < 7 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3572
	p.Checksum[2] = (data[6:])[0]
3573 3574 3575
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3576
	p.Checksum[3] = (data[7:])[0]
3577 3578 3579
	if len(data) < 9 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3580
	p.Checksum[4] = (data[8:])[0]
3581 3582 3583
	if len(data) < 10 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3584
	p.Checksum[5] = (data[9:])[0]
3585 3586 3587
	if len(data) < 11 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3588
	p.Checksum[6] = (data[10:])[0]
3589 3590 3591
	if len(data) < 12 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3592
	p.Checksum[7] = (data[11:])[0]
3593 3594 3595
	if len(data) < 13 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3596
	p.Checksum[8] = (data[12:])[0]
3597 3598 3599
	if len(data) < 14 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3600
	p.Checksum[9] = (data[13:])[0]
3601 3602 3603
	if len(data) < 15 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3604
	p.Checksum[10] = (data[14:])[0]
3605 3606 3607
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3608
	p.Checksum[11] = (data[15:])[0]
3609 3610 3611
	if len(data) < 17 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3612
	p.Checksum[12] = (data[16:])[0]
3613 3614 3615
	if len(data) < 18 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3616
	p.Checksum[13] = (data[17:])[0]
3617 3618 3619
	if len(data) < 19 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3620
	p.Checksum[14] = (data[18:])[0]
3621 3622 3623
	if len(data) < 20 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3624
	p.Checksum[15] = (data[19:])[0]
3625 3626 3627
	if len(data) < 21 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3628
	p.Checksum[16] = (data[20:])[0]
3629 3630 3631
	if len(data) < 22 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3632
	p.Checksum[17] = (data[21:])[0]
3633 3634 3635
	if len(data) < 23 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3636
	p.Checksum[18] = (data[22:])[0]
3637 3638 3639
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3640
	p.Checksum[19] = (data[23:])[0]
3641 3642 3643
	if len(data) < 32 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3644
	p.MaxTID = Tid(binary.BigEndian.Uint64(data[24:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3645
	return 32, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3646 3647 3648

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3649 3650
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3651
// 82. CheckSerialRange
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3652

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3653
func (p *CheckSerialRange) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3654
	return 32
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3655 3656
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3657
func (p *CheckSerialRange) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3658 3659 3660 3661 3662 3663
	binary.BigEndian.PutUint32(data[0:], p.Partition)
	binary.BigEndian.PutUint32(data[4:], p.Length)
	binary.BigEndian.PutUint64(data[8:], uint64(p.MinTID))
	binary.BigEndian.PutUint64(data[16:], uint64(p.MaxTID))
	binary.BigEndian.PutUint64(data[24:], uint64(p.MinOID))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3664

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3665
func (p *CheckSerialRange) NEODecode(data []byte) (int, error) {
3666 3667 3668
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3669
	p.Partition = binary.BigEndian.Uint32(data[0:])
3670 3671 3672
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3673
	p.Length = binary.BigEndian.Uint32(data[4:])
3674 3675 3676
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3677
	p.MinTID = Tid(binary.BigEndian.Uint64(data[8:]))
3678 3679 3680
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3681
	p.MaxTID = Tid(binary.BigEndian.Uint64(data[16:]))
3682 3683 3684
	if len(data) < 32 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3685
	p.MinOID = Oid(binary.BigEndian.Uint64(data[24:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3686
	return 32, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3687 3688 3689

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3690 3691
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3692
// 83. AnswerCheckSerialRange
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3693

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3694
func (p *AnswerCheckSerialRange) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3695
	return 60
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3696 3697
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3698
func (p *AnswerCheckSerialRange) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742
	binary.BigEndian.PutUint32(data[0:], p.Count)
	(data[4:])[0] = p.TidChecksum[0]
	(data[5:])[0] = p.TidChecksum[1]
	(data[6:])[0] = p.TidChecksum[2]
	(data[7:])[0] = p.TidChecksum[3]
	(data[8:])[0] = p.TidChecksum[4]
	(data[9:])[0] = p.TidChecksum[5]
	(data[10:])[0] = p.TidChecksum[6]
	(data[11:])[0] = p.TidChecksum[7]
	(data[12:])[0] = p.TidChecksum[8]
	(data[13:])[0] = p.TidChecksum[9]
	(data[14:])[0] = p.TidChecksum[10]
	(data[15:])[0] = p.TidChecksum[11]
	(data[16:])[0] = p.TidChecksum[12]
	(data[17:])[0] = p.TidChecksum[13]
	(data[18:])[0] = p.TidChecksum[14]
	(data[19:])[0] = p.TidChecksum[15]
	(data[20:])[0] = p.TidChecksum[16]
	(data[21:])[0] = p.TidChecksum[17]
	(data[22:])[0] = p.TidChecksum[18]
	(data[23:])[0] = p.TidChecksum[19]
	binary.BigEndian.PutUint64(data[24:], uint64(p.MaxTID))
	(data[32:])[0] = p.OidChecksum[0]
	(data[33:])[0] = p.OidChecksum[1]
	(data[34:])[0] = p.OidChecksum[2]
	(data[35:])[0] = p.OidChecksum[3]
	(data[36:])[0] = p.OidChecksum[4]
	(data[37:])[0] = p.OidChecksum[5]
	(data[38:])[0] = p.OidChecksum[6]
	(data[39:])[0] = p.OidChecksum[7]
	(data[40:])[0] = p.OidChecksum[8]
	(data[41:])[0] = p.OidChecksum[9]
	(data[42:])[0] = p.OidChecksum[10]
	(data[43:])[0] = p.OidChecksum[11]
	(data[44:])[0] = p.OidChecksum[12]
	(data[45:])[0] = p.OidChecksum[13]
	(data[46:])[0] = p.OidChecksum[14]
	(data[47:])[0] = p.OidChecksum[15]
	(data[48:])[0] = p.OidChecksum[16]
	(data[49:])[0] = p.OidChecksum[17]
	(data[50:])[0] = p.OidChecksum[18]
	(data[51:])[0] = p.OidChecksum[19]
	binary.BigEndian.PutUint64(data[52:], uint64(p.MaxOID))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3743

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3744
func (p *AnswerCheckSerialRange) NEODecode(data []byte) (int, error) {
3745 3746 3747
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3748
	p.Count = binary.BigEndian.Uint32(data[0:])
3749 3750 3751
	if len(data) < 5 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3752
	p.TidChecksum[0] = (data[4:])[0]
3753 3754 3755
	if len(data) < 6 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3756
	p.TidChecksum[1] = (data[5:])[0]
3757 3758 3759
	if len(data) < 7 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3760
	p.TidChecksum[2] = (data[6:])[0]
3761 3762 3763
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3764
	p.TidChecksum[3] = (data[7:])[0]
3765 3766 3767
	if len(data) < 9 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3768
	p.TidChecksum[4] = (data[8:])[0]
3769 3770 3771
	if len(data) < 10 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3772
	p.TidChecksum[5] = (data[9:])[0]
3773 3774 3775
	if len(data) < 11 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3776
	p.TidChecksum[6] = (data[10:])[0]
3777 3778 3779
	if len(data) < 12 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3780
	p.TidChecksum[7] = (data[11:])[0]
3781 3782 3783
	if len(data) < 13 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3784
	p.TidChecksum[8] = (data[12:])[0]
3785 3786 3787
	if len(data) < 14 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3788
	p.TidChecksum[9] = (data[13:])[0]
3789 3790 3791
	if len(data) < 15 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3792
	p.TidChecksum[10] = (data[14:])[0]
3793 3794 3795
	if len(data) < 16 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3796
	p.TidChecksum[11] = (data[15:])[0]
3797 3798 3799
	if len(data) < 17 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3800
	p.TidChecksum[12] = (data[16:])[0]
3801 3802 3803
	if len(data) < 18 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3804
	p.TidChecksum[13] = (data[17:])[0]
3805 3806 3807
	if len(data) < 19 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3808
	p.TidChecksum[14] = (data[18:])[0]
3809 3810 3811
	if len(data) < 20 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3812
	p.TidChecksum[15] = (data[19:])[0]
3813 3814 3815
	if len(data) < 21 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3816
	p.TidChecksum[16] = (data[20:])[0]
3817 3818 3819
	if len(data) < 22 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3820
	p.TidChecksum[17] = (data[21:])[0]
3821 3822 3823
	if len(data) < 23 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3824
	p.TidChecksum[18] = (data[22:])[0]
3825 3826 3827
	if len(data) < 24 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3828
	p.TidChecksum[19] = (data[23:])[0]
3829 3830 3831
	if len(data) < 32 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3832
	p.MaxTID = Tid(binary.BigEndian.Uint64(data[24:]))
3833 3834 3835
	if len(data) < 33 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3836
	p.OidChecksum[0] = (data[32:])[0]
3837 3838 3839
	if len(data) < 34 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3840
	p.OidChecksum[1] = (data[33:])[0]
3841 3842 3843
	if len(data) < 35 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3844
	p.OidChecksum[2] = (data[34:])[0]
3845 3846 3847
	if len(data) < 36 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3848
	p.OidChecksum[3] = (data[35:])[0]
3849 3850 3851
	if len(data) < 37 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3852
	p.OidChecksum[4] = (data[36:])[0]
3853 3854 3855
	if len(data) < 38 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3856
	p.OidChecksum[5] = (data[37:])[0]
3857 3858 3859
	if len(data) < 39 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3860
	p.OidChecksum[6] = (data[38:])[0]
3861 3862 3863
	if len(data) < 40 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3864
	p.OidChecksum[7] = (data[39:])[0]
3865 3866 3867
	if len(data) < 41 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3868
	p.OidChecksum[8] = (data[40:])[0]
3869 3870 3871
	if len(data) < 42 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3872
	p.OidChecksum[9] = (data[41:])[0]
3873 3874 3875
	if len(data) < 43 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3876
	p.OidChecksum[10] = (data[42:])[0]
3877 3878 3879
	if len(data) < 44 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3880
	p.OidChecksum[11] = (data[43:])[0]
3881 3882 3883
	if len(data) < 45 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3884
	p.OidChecksum[12] = (data[44:])[0]
3885 3886 3887
	if len(data) < 46 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3888
	p.OidChecksum[13] = (data[45:])[0]
3889 3890 3891
	if len(data) < 47 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3892
	p.OidChecksum[14] = (data[46:])[0]
3893 3894 3895
	if len(data) < 48 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3896
	p.OidChecksum[15] = (data[47:])[0]
3897 3898 3899
	if len(data) < 49 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3900
	p.OidChecksum[16] = (data[48:])[0]
3901 3902 3903
	if len(data) < 50 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3904
	p.OidChecksum[17] = (data[49:])[0]
3905 3906 3907
	if len(data) < 51 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3908
	p.OidChecksum[18] = (data[50:])[0]
3909 3910 3911
	if len(data) < 52 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3912
	p.OidChecksum[19] = (data[51:])[0]
3913 3914 3915
	if len(data) < 60 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3916
	p.MaxOID = Oid(binary.BigEndian.Uint64(data[52:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3917
	return 60, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3918 3919 3920

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3921 3922
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3923
// 84. PartitionCorrupted
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3924

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3925
func (p *PartitionCorrupted) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3926
	return 8 + len(p.CellList)*4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3927 3928
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3929
func (p *PartitionCorrupted) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3930
	binary.BigEndian.PutUint32(data[0:], p.Partition)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3931 3932 3933 3934 3935 3936 3937 3938 3939 3940
	{
		l := uint32(len(p.CellList))
		binary.BigEndian.PutUint32(data[4:], l)
		data = data[8:]
		for i := 0; uint32(i) < l; i++ {
			a := &p.CellList[i]
			binary.BigEndian.PutUint32(data[0:], uint32(int32((*a))))
			data = data[4:]
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3941
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3942

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3943
func (p *PartitionCorrupted) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3944
	var nread0 uint32
3945 3946 3947
	if len(data) < 4 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3948
	p.Partition = binary.BigEndian.Uint32(data[0:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3949
	{
3950 3951 3952
		if len(data) < 8 {
			goto overflow
		}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3953
		l := binary.BigEndian.Uint32(data[4:])
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3954
		data = data[8:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3955
		nread0 += 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3956
		p.CellList = make([]UUID, l)
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3957
		for i := 0; uint32(i) < l; i++ {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3958
			a := &p.CellList[i]
3959 3960 3961
			if len(data) < 4 {
				goto overflow
			}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3962
			(*a) = UUID(int32(binary.BigEndian.Uint32(data[0:])))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3963
			data = data[4:]
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3964
			nread0 += 4
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3965 3966
		}
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3967
	return 0 + int(nread0), nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3968 3969 3970

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3971 3972
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3973
// 85. LastTransaction
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3974

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3975
func (p *LastTransaction) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3976
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3977 3978
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3979
func (p *LastTransaction) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3980
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3981

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3982
func (p *LastTransaction) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3983
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3984 3985
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3986
// 86. AnswerLastTransaction
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3987

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3988
func (p *AnswerLastTransaction) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3989
	return 8
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3990 3991
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3992
func (p *AnswerLastTransaction) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3993 3994
	binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3995

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
3996
func (p *AnswerLastTransaction) NEODecode(data []byte) (int, error) {
3997 3998 3999
	if len(data) < 8 {
		goto overflow
	}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4000
	p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4001
	return 8, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4002 4003 4004

overflow:
	return 0, ErrDecodeOverflow
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4005 4006
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4007
// 87. NotifyReady
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4008

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4009
func (p *NotifyReady) NEOEncodedLen() int {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4010
	return 0
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4011 4012
}

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4013
func (p *NotifyReady) NEOEncode(data []byte) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4014
}
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4015

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4016
func (p *NotifyReady) NEODecode(data []byte) (int, error) {
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4017
	return 0, nil
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
4018
}