Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
dd43cd5b
Commit
dd43cd5b
authored
Jan 19, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6647e47c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
788 additions
and
146 deletions
+788
-146
t/neo/marshal.go
t/neo/marshal.go
+753
-126
t/neo/protogen.go
t/neo/protogen.go
+35
-20
No files found.
t/neo/marshal.go
View file @
dd43cd5b
...
@@ -8,16 +8,21 @@ import (
...
@@ -8,16 +8,21 @@ import (
// 0. Address
// 0. Address
func
(
p
*
Address
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
Host
))
size
+=
4
+
l
}
return
int
(
size
)
+
2
}
func
(
p
*
Address
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Address
)
NEOEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
Host
))
l
:=
uint32
(
len
(
p
.
Host
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Host
)
copy
(
data
,
p
.
Host
)
nwrote
+=
4
+
l
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Port
)
}
}
...
@@ -44,17 +49,22 @@ overflow:
...
@@ -44,17 +49,22 @@ overflow:
// 1. NodeInfo
// 1. NodeInfo
func
(
p
*
NodeInfo
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
Address
.
Host
))
size
+=
8
+
l
}
return
int
(
size
)
+
18
}
func
(
p
*
NodeInfo
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NodeInfo
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
{
{
l
:=
uint32
(
len
(
p
.
Address
.
Host
))
l
:=
uint32
(
len
(
p
.
Address
.
Host
))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Address
.
Host
)
copy
(
data
,
p
.
Address
.
Host
)
nwrote
+=
8
+
l
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
(
p
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
(
p
.
UUID
)))
...
@@ -88,6 +98,11 @@ overflow:
...
@@ -88,6 +98,11 @@ overflow:
// 2. CellInfo
// 2. CellInfo
func
(
p
*
CellInfo
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
CellInfo
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CellInfo
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
CellState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
CellState
)))
...
@@ -106,19 +121,31 @@ overflow:
...
@@ -106,19 +121,31 @@ overflow:
// 3. RowInfo
// 3. RowInfo
func
(
p
*
RowInfo
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
CellList
))
size
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
_
=
a
size
+=
8
}
}
return
int
(
size
)
+
0
}
func
(
p
*
RowInfo
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RowInfo
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Offset
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Offset
)
{
{
l
:=
uint32
(
len
(
p
.
CellList
))
l
:=
uint32
(
len
(
p
.
CellList
))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
a
:=
&
p
.
CellList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
CellState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
CellState
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
}
}
...
@@ -148,16 +175,21 @@ overflow:
...
@@ -148,16 +175,21 @@ overflow:
// 4. Notify
// 4. Notify
func
(
p
*
Notify
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
Message
))
size
+=
4
+
l
}
return
int
(
size
)
+
0
}
func
(
p
*
Notify
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Notify
)
NEOEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
Message
))
l
:=
uint32
(
len
(
p
.
Message
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Message
)
copy
(
data
,
p
.
Message
)
nwrote
+=
4
+
l
}
}
}
}
...
@@ -182,17 +214,22 @@ overflow:
...
@@ -182,17 +214,22 @@ overflow:
// 5. Error
// 5. Error
func
(
p
*
Error
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
Message
))
size
+=
8
+
l
}
return
int
(
size
)
+
0
}
func
(
p
*
Error
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Error
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Code
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Code
)
{
{
l
:=
uint32
(
len
(
p
.
Message
))
l
:=
uint32
(
len
(
p
.
Message
))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Message
)
copy
(
data
,
p
.
Message
)
nwrote
+=
8
+
l
}
}
}
}
...
@@ -218,6 +255,11 @@ overflow:
...
@@ -218,6 +255,11 @@ overflow:
// 6. Ping
// 6. Ping
func
(
p
*
Ping
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
Ping
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Ping
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -232,6 +274,11 @@ overflow:
...
@@ -232,6 +274,11 @@ overflow:
// 7. CloseClient
// 7. CloseClient
func
(
p
*
CloseClient
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
CloseClient
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CloseClient
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -246,6 +293,19 @@ overflow:
...
@@ -246,6 +293,19 @@ overflow:
// 8. RequestIdentification
// 8. RequestIdentification
func
(
p
*
RequestIdentification
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
Address
.
Host
))
size
+=
16
+
l
}
{
l
:=
uint32
(
len
(
p
.
Name
))
size
+=
6
+
l
}
return
int
(
size
)
+
8
}
func
(
p
*
RequestIdentification
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RequestIdentification
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
ProtocolVersion
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
ProtocolVersion
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
NodeType
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
NodeType
)))
...
@@ -254,22 +314,14 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
...
@@ -254,22 +314,14 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
l
:=
uint32
(
len
(
p
.
Address
.
Host
))
l
:=
uint32
(
len
(
p
.
Address
.
Host
))
binary
.
BigEndian
.
PutUint32
(
data
[
12
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
12
:
],
l
)
data
=
data
[
16
:
]
data
=
data
[
16
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Address
.
Host
)
copy
(
data
,
p
.
Address
.
Host
)
nwrote
+=
16
+
l
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Address
.
Port
)
{
{
l
:=
uint32
(
len
(
p
.
Name
))
l
:=
uint32
(
len
(
p
.
Name
))
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
l
)
data
=
data
[
6
:
]
data
=
data
[
6
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Name
)
copy
(
data
,
p
.
Name
)
nwrote
+=
6
+
l
}
}
float64_NEOEncode
(
data
[
0
:
],
p
.
IdTimestamp
)
float64_NEOEncode
(
data
[
0
:
],
p
.
IdTimestamp
)
}
}
...
@@ -310,6 +362,28 @@ overflow:
...
@@ -310,6 +362,28 @@ overflow:
// 9. AcceptIdentification
// 9. AcceptIdentification
func
(
p
*
AcceptIdentification
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
Primary
.
Host
))
size
+=
24
+
l
}
{
l
:=
uint32
(
len
(
p
.
KnownMasterList
))
size
+=
2
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
KnownMasterList
[
i
]
{
l
:=
uint32
(
len
((
*
a
)
.
Address
.
Host
))
size
+=
4
+
l
}
_
=
a
size
+=
6
}
}
return
int
(
size
)
+
0
}
func
(
p
*
AcceptIdentification
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AcceptIdentification
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
MyUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
MyUUID
)))
...
@@ -320,34 +394,24 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
...
@@ -320,34 +394,24 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
l
:=
uint32
(
len
(
p
.
Primary
.
Host
))
l
:=
uint32
(
len
(
p
.
Primary
.
Host
))
binary
.
BigEndian
.
PutUint32
(
data
[
20
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
20
:
],
l
)
data
=
data
[
24
:
]
data
=
data
[
24
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Primary
.
Host
)
copy
(
data
,
p
.
Primary
.
Host
)
nwrote
+=
24
+
l
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Primary
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Primary
.
Port
)
{
{
l
:=
uint32
(
len
(
p
.
KnownMasterList
))
l
:=
uint32
(
len
(
p
.
KnownMasterList
))
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
l
)
data
=
data
[
6
:
]
data
=
data
[
6
:
]
nwrote
+=
6
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
KnownMasterList
[
i
]
a
:=
&
p
.
KnownMasterList
[
i
]
{
{
l
:=
uint32
(
len
((
*
a
)
.
Address
.
Host
))
l
:=
uint32
(
len
((
*
a
)
.
Address
.
Host
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
nwrote
+=
4
+
l
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
data
=
data
[
6
:
]
data
=
data
[
6
:
]
nwrote
+=
6
}
}
}
}
}
}
...
@@ -405,6 +469,11 @@ overflow:
...
@@ -405,6 +469,11 @@ overflow:
// 10. PrimaryMaster
// 10. PrimaryMaster
func
(
p
*
PrimaryMaster
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
PrimaryMaster
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PrimaryMaster
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -419,6 +488,11 @@ overflow:
...
@@ -419,6 +488,11 @@ overflow:
// 11. AnswerPrimary
// 11. AnswerPrimary
func
(
p
*
AnswerPrimary
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
4
}
func
(
p
*
AnswerPrimary
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPrimary
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
PrimaryUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
PrimaryUUID
)))
}
}
...
@@ -435,6 +509,11 @@ overflow:
...
@@ -435,6 +509,11 @@ overflow:
// 12. AnnouncePrimary
// 12. AnnouncePrimary
func
(
p
*
AnnouncePrimary
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
AnnouncePrimary
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnnouncePrimary
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -449,6 +528,11 @@ overflow:
...
@@ -449,6 +528,11 @@ overflow:
// 13. ReelectPrimary
// 13. ReelectPrimary
func
(
p
*
ReelectPrimary
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
ReelectPrimary
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ReelectPrimary
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -463,6 +547,11 @@ overflow:
...
@@ -463,6 +547,11 @@ overflow:
// 14. Recovery
// 14. Recovery
func
(
p
*
Recovery
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
Recovery
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Recovery
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -477,6 +566,11 @@ overflow:
...
@@ -477,6 +566,11 @@ overflow:
// 15. AnswerRecovery
// 15. AnswerRecovery
func
(
p
*
AnswerRecovery
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
24
}
func
(
p
*
AnswerRecovery
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerRecovery
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
BackupTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
BackupTID
))
...
@@ -497,6 +591,11 @@ overflow:
...
@@ -497,6 +591,11 @@ overflow:
// 16. LastIDs
// 16. LastIDs
func
(
p
*
LastIDs
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
LastIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LastIDs
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -511,6 +610,11 @@ overflow:
...
@@ -511,6 +610,11 @@ overflow:
// 17. AnswerLastIDs
// 17. AnswerLastIDs
func
(
p
*
AnswerLastIDs
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
16
}
func
(
p
*
AnswerLastIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLastIDs
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
LastOID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
LastOID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
LastTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
LastTID
))
...
@@ -529,6 +633,11 @@ overflow:
...
@@ -529,6 +633,11 @@ overflow:
// 18. PartitionTable
// 18. PartitionTable
func
(
p
*
PartitionTable
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
PartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PartitionTable
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -543,13 +652,35 @@ overflow:
...
@@ -543,13 +652,35 @@ overflow:
// 19. AnswerPartitionTable
// 19. AnswerPartitionTable
func
(
p
*
AnswerPartitionTable
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
RowList
))
size
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
{
l
:=
uint32
(
len
((
*
a
)
.
CellList
))
size
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
_
=
a
size
+=
8
}
}
_
=
a
size
+=
0
}
}
return
int
(
size
)
+
0
}
func
(
p
*
AnswerPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
{
{
l
:=
uint32
(
len
(
p
.
RowList
))
l
:=
uint32
(
len
(
p
.
RowList
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nwrote
+=
12
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
(
*
a
)
.
Offset
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
(
*
a
)
.
Offset
)
...
@@ -557,17 +688,14 @@ func (p *AnswerPartitionTable) NEOEncode(data []byte) {
...
@@ -557,17 +688,14 @@ func (p *AnswerPartitionTable) NEOEncode(data []byte) {
l
:=
uint32
(
len
((
*
a
)
.
CellList
))
l
:=
uint32
(
len
((
*
a
)
.
CellList
))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
a
:=
&
(
*
a
)
.
CellList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
CellState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
CellState
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
data
=
data
[
0
:
]
data
=
data
[
0
:
]
nwrote
+=
0
}
}
}
}
}
}
...
@@ -609,13 +737,35 @@ overflow:
...
@@ -609,13 +737,35 @@ overflow:
// 20. NotifyPartitionTable
// 20. NotifyPartitionTable
func
(
p
*
NotifyPartitionTable
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
RowList
))
size
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
{
l
:=
uint32
(
len
((
*
a
)
.
CellList
))
size
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
_
=
a
size
+=
8
}
}
_
=
a
size
+=
0
}
}
return
int
(
size
)
+
0
}
func
(
p
*
NotifyPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
{
{
l
:=
uint32
(
len
(
p
.
RowList
))
l
:=
uint32
(
len
(
p
.
RowList
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nwrote
+=
12
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
(
*
a
)
.
Offset
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
(
*
a
)
.
Offset
)
...
@@ -623,17 +773,14 @@ func (p *NotifyPartitionTable) NEOEncode(data []byte) {
...
@@ -623,17 +773,14 @@ func (p *NotifyPartitionTable) NEOEncode(data []byte) {
l
:=
uint32
(
len
((
*
a
)
.
CellList
))
l
:=
uint32
(
len
((
*
a
)
.
CellList
))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
a
:=
&
(
*
a
)
.
CellList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
CellState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
CellState
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
data
=
data
[
0
:
]
data
=
data
[
0
:
]
nwrote
+=
0
}
}
}
}
}
}
...
@@ -675,20 +822,32 @@ overflow:
...
@@ -675,20 +822,32 @@ overflow:
// 21. PartitionChanges
// 21. PartitionChanges
func
(
p
*
PartitionChanges
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
CellList
))
size
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
_
=
a
size
+=
12
}
}
return
int
(
size
)
+
0
}
func
(
p
*
PartitionChanges
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PartitionChanges
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
{
{
l
:=
uint32
(
len
(
p
.
CellList
))
l
:=
uint32
(
len
(
p
.
CellList
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nwrote
+=
12
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
a
:=
&
p
.
CellList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
(
*
a
)
.
Offset
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
(
*
a
)
.
Offset
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
uint32
(
int32
((
*
a
)
.
CellState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
uint32
(
int32
((
*
a
)
.
CellState
)))
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nwrote
+=
12
}
}
}
}
}
}
...
@@ -723,6 +882,11 @@ overflow:
...
@@ -723,6 +882,11 @@ overflow:
// 22. StartOperation
// 22. StartOperation
func
(
p
*
StartOperation
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
1
}
func
(
p
*
StartOperation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StartOperation
)
NEOEncode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Backup
)
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Backup
)
}
}
...
@@ -739,6 +903,11 @@ overflow:
...
@@ -739,6 +903,11 @@ overflow:
// 23. StopOperation
// 23. StopOperation
func
(
p
*
StopOperation
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
StopOperation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StopOperation
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -753,6 +922,11 @@ overflow:
...
@@ -753,6 +922,11 @@ overflow:
// 24. UnfinishedTransactions
// 24. UnfinishedTransactions
func
(
p
*
UnfinishedTransactions
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
UnfinishedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
UnfinishedTransactions
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -767,18 +941,30 @@ overflow:
...
@@ -767,18 +941,30 @@ overflow:
// 25. AnswerUnfinishedTransactions
// 25. AnswerUnfinishedTransactions
func
(
p
*
AnswerUnfinishedTransactions
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
TidList
))
size
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
_
=
a
size
+=
8
}
}
return
int
(
size
)
+
0
}
func
(
p
*
AnswerUnfinishedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerUnfinishedTransactions
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
MaxTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
MaxTID
))
{
{
l
:=
uint32
(
len
(
p
.
TidList
))
l
:=
uint32
(
len
(
p
.
TidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nwrote
+=
12
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
a
:=
&
p
.
TidList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)
.
UnfinishedTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)
.
UnfinishedTID
))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
}
}
...
@@ -807,6 +993,11 @@ overflow:
...
@@ -807,6 +993,11 @@ overflow:
// 26. LockedTransactions
// 26. LockedTransactions
func
(
p
*
LockedTransactions
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
LockedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LockedTransactions
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -821,6 +1012,12 @@ overflow:
...
@@ -821,6 +1012,12 @@ overflow:
// 27. AnswerLockedTransactions
// 27. AnswerLockedTransactions
func
(
p
*
AnswerLockedTransactions
)
NEOEncodedLen
()
int
{
var
size
uint32
// TODO map
return
int
(
size
)
+
0
}
func
(
p
*
AnswerLockedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLockedTransactions
)
NEOEncode
(
data
[]
byte
)
{
// TODO map
// TODO map
}
}
...
@@ -849,6 +1046,11 @@ overflow:
...
@@ -849,6 +1046,11 @@ overflow:
// 28. FinalTID
// 28. FinalTID
func
(
p
*
FinalTID
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
FinalTID
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
FinalTID
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
}
}
...
@@ -865,6 +1067,11 @@ overflow:
...
@@ -865,6 +1067,11 @@ overflow:
// 29. AnswerFinalTID
// 29. AnswerFinalTID
func
(
p
*
AnswerFinalTID
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
AnswerFinalTID
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerFinalTID
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
...
@@ -881,6 +1088,11 @@ overflow:
...
@@ -881,6 +1088,11 @@ overflow:
// 30. ValidateTransaction
// 30. ValidateTransaction
func
(
p
*
ValidateTransaction
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
16
}
func
(
p
*
ValidateTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ValidateTransaction
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
...
@@ -899,6 +1111,11 @@ overflow:
...
@@ -899,6 +1111,11 @@ overflow:
// 31. BeginTransaction
// 31. BeginTransaction
func
(
p
*
BeginTransaction
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
BeginTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
BeginTransaction
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
...
@@ -915,6 +1132,11 @@ overflow:
...
@@ -915,6 +1132,11 @@ overflow:
// 32. AnswerBeginTransaction
// 32. AnswerBeginTransaction
func
(
p
*
AnswerBeginTransaction
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
AnswerBeginTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerBeginTransaction
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
...
@@ -931,30 +1153,49 @@ overflow:
...
@@ -931,30 +1153,49 @@ overflow:
// 33. FinishTransaction
// 33. FinishTransaction
func
(
p
*
FinishTransaction
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
OIDList
))
size
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OIDList
[
i
]
_
=
a
size
+=
8
}
}
{
l
:=
uint32
(
len
(
p
.
CheckedList
))
size
+=
0
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CheckedList
[
i
]
_
=
a
size
+=
8
}
}
return
int
(
size
)
+
0
}
func
(
p
*
FinishTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
FinishTransaction
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
{
l
:=
uint32
(
len
(
p
.
OIDList
))
l
:=
uint32
(
len
(
p
.
OIDList
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nwrote
+=
12
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OIDList
[
i
]
a
:=
&
p
.
OIDList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
{
{
l
:=
uint32
(
len
(
p
.
CheckedList
))
l
:=
uint32
(
len
(
p
.
CheckedList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CheckedList
[
i
]
a
:=
&
p
.
CheckedList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
}
}
...
@@ -995,6 +1236,11 @@ overflow:
...
@@ -995,6 +1236,11 @@ overflow:
// 34. AnswerFinishTransaction
// 34. AnswerFinishTransaction
func
(
p
*
AnswerFinishTransaction
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
16
}
func
(
p
*
AnswerFinishTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerFinishTransaction
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
...
@@ -1013,6 +1259,11 @@ overflow:
...
@@ -1013,6 +1259,11 @@ overflow:
// 35. NotifyTransactionFinished
// 35. NotifyTransactionFinished
func
(
p
*
NotifyTransactionFinished
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
16
}
func
(
p
*
NotifyTransactionFinished
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyTransactionFinished
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
...
@@ -1031,6 +1282,11 @@ overflow:
...
@@ -1031,6 +1282,11 @@ overflow:
// 36. LockInformation
// 36. LockInformation
func
(
p
*
LockInformation
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
16
}
func
(
p
*
LockInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LockInformation
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Ttid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Ttid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
...
@@ -1049,6 +1305,11 @@ overflow:
...
@@ -1049,6 +1305,11 @@ overflow:
// 37. AnswerLockInformation
// 37. AnswerLockInformation
func
(
p
*
AnswerLockInformation
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
AnswerLockInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLockInformation
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Ttid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Ttid
))
}
}
...
@@ -1065,18 +1326,30 @@ overflow:
...
@@ -1065,18 +1326,30 @@ overflow:
// 38. InvalidateObjects
// 38. InvalidateObjects
func
(
p
*
InvalidateObjects
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
OidList
))
size
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
_
=
a
size
+=
8
}
}
return
int
(
size
)
+
0
}
func
(
p
*
InvalidateObjects
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
InvalidateObjects
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
{
l
:=
uint32
(
len
(
p
.
OidList
))
l
:=
uint32
(
len
(
p
.
OidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nwrote
+=
12
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
:=
&
p
.
OidList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
}
}
...
@@ -1105,6 +1378,11 @@ overflow:
...
@@ -1105,6 +1378,11 @@ overflow:
// 39. UnlockInformation
// 39. UnlockInformation
func
(
p
*
UnlockInformation
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
UnlockInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
UnlockInformation
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
}
}
...
@@ -1121,6 +1399,11 @@ overflow:
...
@@ -1121,6 +1399,11 @@ overflow:
// 40. GenerateOIDs
// 40. GenerateOIDs
func
(
p
*
GenerateOIDs
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
4
}
func
(
p
*
GenerateOIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
GenerateOIDs
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
NumOIDs
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
NumOIDs
)
}
}
...
@@ -1137,17 +1420,29 @@ overflow:
...
@@ -1137,17 +1420,29 @@ overflow:
// 41. AnswerGenerateOIDs
// 41. AnswerGenerateOIDs
func
(
p
*
AnswerGenerateOIDs
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
OidList
))
size
+=
0
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
_
=
a
size
+=
8
}
}
return
int
(
size
)
+
0
}
func
(
p
*
AnswerGenerateOIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerGenerateOIDs
)
NEOEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
OidList
))
l
:=
uint32
(
len
(
p
.
OidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
:=
&
p
.
OidList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
}
}
...
@@ -1175,6 +1470,20 @@ overflow:
...
@@ -1175,6 +1470,20 @@ overflow:
// 42. StoreObject
// 42. StoreObject
func
(
p
*
StoreObject
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
Data
))
size
+=
37
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
Data
[
i
]
_
=
a
size
+=
1
}
}
return
int
(
size
)
+
17
}
func
(
p
*
StoreObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StoreObject
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Serial
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Serial
))
...
@@ -1203,12 +1512,10 @@ func (p *StoreObject) NEOEncode(data []byte) {
...
@@ -1203,12 +1512,10 @@ func (p *StoreObject) NEOEncode(data []byte) {
l
:=
uint32
(
len
(
p
.
Data
))
l
:=
uint32
(
len
(
p
.
Data
))
binary
.
BigEndian
.
PutUint32
(
data
[
37
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
37
:
],
l
)
data
=
data
[
41
:
]
data
=
data
[
41
:
]
nwrote
+=
41
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
Data
[
i
]
a
:=
&
p
.
Data
[
i
]
(
data
[
0
:
])[
0
]
=
(
*
a
)
(
data
[
0
:
])[
0
]
=
(
*
a
)
data
=
data
[
1
:
]
data
=
data
[
1
:
]
nwrote
+=
1
}
}
}
}
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
DataSerial
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
DataSerial
))
...
@@ -1265,6 +1572,11 @@ overflow:
...
@@ -1265,6 +1572,11 @@ overflow:
// 43. AnswerStoreObject
// 43. AnswerStoreObject
func
(
p
*
AnswerStoreObject
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
17
}
func
(
p
*
AnswerStoreObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerStoreObject
)
NEOEncode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Conflicting
)
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Conflicting
)
binary
.
BigEndian
.
PutUint64
(
data
[
1
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
1
:
],
uint64
(
p
.
Oid
))
...
@@ -1285,6 +1597,11 @@ overflow:
...
@@ -1285,6 +1597,11 @@ overflow:
// 44. AbortTransaction
// 44. AbortTransaction
func
(
p
*
AbortTransaction
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
AbortTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AbortTransaction
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
...
@@ -1301,48 +1618,60 @@ overflow:
...
@@ -1301,48 +1618,60 @@ overflow:
// 45. StoreTransaction
// 45. StoreTransaction
func
(
p
*
StoreTransaction
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
User
))
size
+=
12
+
l
}
{
l
:=
uint32
(
len
(
p
.
Description
))
size
+=
4
+
l
}
{
l
:=
uint32
(
len
(
p
.
Extension
))
size
+=
4
+
l
}
{
l
:=
uint32
(
len
(
p
.
OidList
))
size
+=
0
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
_
=
a
size
+=
8
}
}
return
int
(
size
)
+
0
}
func
(
p
*
StoreTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StoreTransaction
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
{
l
:=
uint32
(
len
(
p
.
User
))
l
:=
uint32
(
len
(
p
.
User
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
User
)
copy
(
data
,
p
.
User
)
nwrote
+=
12
+
l
}
}
{
{
l
:=
uint32
(
len
(
p
.
Description
))
l
:=
uint32
(
len
(
p
.
Description
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Description
)
copy
(
data
,
p
.
Description
)
nwrote
+=
4
+
l
}
}
{
{
l
:=
uint32
(
len
(
p
.
Extension
))
l
:=
uint32
(
len
(
p
.
Extension
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Extension
)
copy
(
data
,
p
.
Extension
)
nwrote
+=
4
+
l
}
}
{
{
l
:=
uint32
(
len
(
p
.
OidList
))
l
:=
uint32
(
len
(
p
.
OidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
:=
&
p
.
OidList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
}
}
...
@@ -1401,6 +1730,11 @@ overflow:
...
@@ -1401,6 +1730,11 @@ overflow:
// 46. VoteTransaction
// 46. VoteTransaction
func
(
p
*
VoteTransaction
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
VoteTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
VoteTransaction
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
...
@@ -1417,6 +1751,11 @@ overflow:
...
@@ -1417,6 +1751,11 @@ overflow:
// 47. GetObject
// 47. GetObject
func
(
p
*
GetObject
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
24
}
func
(
p
*
GetObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
GetObject
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Serial
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Serial
))
...
@@ -1437,6 +1776,20 @@ overflow:
...
@@ -1437,6 +1776,20 @@ overflow:
// 48. AnswerGetObject
// 48. AnswerGetObject
func
(
p
*
AnswerGetObject
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
Data
))
size
+=
45
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
Data
[
i
]
_
=
a
size
+=
1
}
}
return
int
(
size
)
+
8
}
func
(
p
*
AnswerGetObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerGetObject
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
SerialStart
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
SerialStart
))
...
@@ -1466,12 +1819,10 @@ func (p *AnswerGetObject) NEOEncode(data []byte) {
...
@@ -1466,12 +1819,10 @@ func (p *AnswerGetObject) NEOEncode(data []byte) {
l
:=
uint32
(
len
(
p
.
Data
))
l
:=
uint32
(
len
(
p
.
Data
))
binary
.
BigEndian
.
PutUint32
(
data
[
45
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
45
:
],
l
)
data
=
data
[
49
:
]
data
=
data
[
49
:
]
nwrote
+=
49
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
Data
[
i
]
a
:=
&
p
.
Data
[
i
]
(
data
[
0
:
])[
0
]
=
(
*
a
)
(
data
[
0
:
])[
0
]
=
(
*
a
)
data
=
data
[
1
:
]
data
=
data
[
1
:
]
nwrote
+=
1
}
}
}
}
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
DataSerial
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
DataSerial
))
...
@@ -1525,6 +1876,11 @@ overflow:
...
@@ -1525,6 +1876,11 @@ overflow:
// 49. TIDList
// 49. TIDList
func
(
p
*
TIDList
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
20
}
func
(
p
*
TIDList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TIDList
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
p
.
First
)
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
p
.
First
)
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
p
.
Last
)
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
p
.
Last
)
...
@@ -1545,17 +1901,29 @@ overflow:
...
@@ -1545,17 +1901,29 @@ overflow:
// 50. AnswerTIDList
// 50. AnswerTIDList
func
(
p
*
AnswerTIDList
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
TIDList
))
size
+=
0
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TIDList
[
i
]
_
=
a
size
+=
8
}
}
return
int
(
size
)
+
0
}
func
(
p
*
AnswerTIDList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerTIDList
)
NEOEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
TIDList
))
l
:=
uint32
(
len
(
p
.
TIDList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TIDList
[
i
]
a
:=
&
p
.
TIDList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
}
}
...
@@ -1583,6 +1951,11 @@ overflow:
...
@@ -1583,6 +1951,11 @@ overflow:
// 51. TIDListFrom
// 51. TIDListFrom
func
(
p
*
TIDListFrom
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
24
}
func
(
p
*
TIDListFrom
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TIDListFrom
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
...
@@ -1605,17 +1978,29 @@ overflow:
...
@@ -1605,17 +1978,29 @@ overflow:
// 52. AnswerTIDListFrom
// 52. AnswerTIDListFrom
func
(
p
*
AnswerTIDListFrom
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
TidList
))
size
+=
0
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
_
=
a
size
+=
8
}
}
return
int
(
size
)
+
0
}
func
(
p
*
AnswerTIDListFrom
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerTIDListFrom
)
NEOEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
TidList
))
l
:=
uint32
(
len
(
p
.
TidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
a
:=
&
p
.
TidList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
}
}
...
@@ -1643,6 +2028,11 @@ overflow:
...
@@ -1643,6 +2028,11 @@ overflow:
// 53. TransactionInformation
// 53. TransactionInformation
func
(
p
*
TransactionInformation
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
TransactionInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TransactionInformation
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
...
@@ -1659,49 +2049,61 @@ overflow:
...
@@ -1659,49 +2049,61 @@ overflow:
// 54. AnswerTransactionInformation
// 54. AnswerTransactionInformation
func
(
p
*
AnswerTransactionInformation
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
User
))
size
+=
12
+
l
}
{
l
:=
uint32
(
len
(
p
.
Description
))
size
+=
4
+
l
}
{
l
:=
uint32
(
len
(
p
.
Extension
))
size
+=
4
+
l
}
{
l
:=
uint32
(
len
(
p
.
OidList
))
size
+=
1
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
_
=
a
size
+=
8
}
}
return
int
(
size
)
+
0
}
func
(
p
*
AnswerTransactionInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerTransactionInformation
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
{
l
:=
uint32
(
len
(
p
.
User
))
l
:=
uint32
(
len
(
p
.
User
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
User
)
copy
(
data
,
p
.
User
)
nwrote
+=
12
+
l
}
}
{
{
l
:=
uint32
(
len
(
p
.
Description
))
l
:=
uint32
(
len
(
p
.
Description
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Description
)
copy
(
data
,
p
.
Description
)
nwrote
+=
4
+
l
}
}
{
{
l
:=
uint32
(
len
(
p
.
Extension
))
l
:=
uint32
(
len
(
p
.
Extension
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Extension
)
copy
(
data
,
p
.
Extension
)
nwrote
+=
4
+
l
}
}
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Packed
)
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Packed
)
{
{
l
:=
uint32
(
len
(
p
.
OidList
))
l
:=
uint32
(
len
(
p
.
OidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
1
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
1
:
],
l
)
data
=
data
[
5
:
]
data
=
data
[
5
:
]
nwrote
+=
5
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
:=
&
p
.
OidList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
}
}
...
@@ -1761,6 +2163,11 @@ overflow:
...
@@ -1761,6 +2163,11 @@ overflow:
// 55. ObjectHistory
// 55. ObjectHistory
func
(
p
*
ObjectHistory
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
24
}
func
(
p
*
ObjectHistory
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ObjectHistory
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
p
.
First
)
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
p
.
First
)
...
@@ -1781,19 +2188,31 @@ overflow:
...
@@ -1781,19 +2188,31 @@ overflow:
// 56. AnswerObjectHistory
// 56. AnswerObjectHistory
func
(
p
*
AnswerObjectHistory
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
HistoryList
))
size
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
HistoryList
[
i
]
_
=
a
size
+=
12
}
}
return
int
(
size
)
+
0
}
func
(
p
*
AnswerObjectHistory
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerObjectHistory
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
{
{
l
:=
uint32
(
len
(
p
.
HistoryList
))
l
:=
uint32
(
len
(
p
.
HistoryList
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nwrote
+=
12
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
HistoryList
[
i
]
a
:=
&
p
.
HistoryList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)
.
Serial
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)
.
Serial
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
(
*
a
)
.
Size
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
(
*
a
)
.
Size
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nwrote
+=
12
}
}
}
}
}
}
...
@@ -1826,6 +2245,11 @@ overflow:
...
@@ -1826,6 +2245,11 @@ overflow:
// 57. PartitionList
// 57. PartitionList
func
(
p
*
PartitionList
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
12
}
func
(
p
*
PartitionList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PartitionList
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
MinOffset
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
MinOffset
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
p
.
MaxOffset
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
p
.
MaxOffset
)
...
@@ -1846,13 +2270,35 @@ overflow:
...
@@ -1846,13 +2270,35 @@ overflow:
// 58. AnswerPartitionList
// 58. AnswerPartitionList
func
(
p
*
AnswerPartitionList
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
RowList
))
size
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
{
l
:=
uint32
(
len
((
*
a
)
.
CellList
))
size
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
_
=
a
size
+=
8
}
}
_
=
a
size
+=
0
}
}
return
int
(
size
)
+
0
}
func
(
p
*
AnswerPartitionList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPartitionList
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
{
{
l
:=
uint32
(
len
(
p
.
RowList
))
l
:=
uint32
(
len
(
p
.
RowList
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nwrote
+=
12
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
(
*
a
)
.
Offset
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
(
*
a
)
.
Offset
)
...
@@ -1860,17 +2306,14 @@ func (p *AnswerPartitionList) NEOEncode(data []byte) {
...
@@ -1860,17 +2306,14 @@ func (p *AnswerPartitionList) NEOEncode(data []byte) {
l
:=
uint32
(
len
((
*
a
)
.
CellList
))
l
:=
uint32
(
len
((
*
a
)
.
CellList
))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
a
:=
&
(
*
a
)
.
CellList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
CellState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
CellState
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
data
=
data
[
0
:
]
data
=
data
[
0
:
]
nwrote
+=
0
}
}
}
}
}
}
...
@@ -1912,6 +2355,11 @@ overflow:
...
@@ -1912,6 +2355,11 @@ overflow:
// 59. X_NodeList
// 59. X_NodeList
func
(
p
*
X_NodeList
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
4
}
func
(
p
*
X_NodeList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
X_NodeList
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
}
}
...
@@ -1928,12 +2376,29 @@ overflow:
...
@@ -1928,12 +2376,29 @@ overflow:
// 60. AnswerNodeList
// 60. AnswerNodeList
func
(
p
*
AnswerNodeList
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
NodeList
))
size
+=
0
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
NodeList
[
i
]
{
l
:=
uint32
(
len
((
*
a
)
.
Address
.
Host
))
size
+=
8
+
l
}
_
=
a
size
+=
18
}
}
return
int
(
size
)
+
0
}
func
(
p
*
AnswerNodeList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerNodeList
)
NEOEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
l
:=
uint32
(
len
(
p
.
NodeList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
NodeList
[
i
]
a
:=
&
p
.
NodeList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
NodeType
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
NodeType
)))
...
@@ -1941,18 +2406,13 @@ func (p *AnswerNodeList) NEOEncode(data []byte) {
...
@@ -1941,18 +2406,13 @@ func (p *AnswerNodeList) NEOEncode(data []byte) {
l
:=
uint32
(
len
((
*
a
)
.
Address
.
Host
))
l
:=
uint32
(
len
((
*
a
)
.
Address
.
Host
))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
nwrote
+=
8
+
l
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
6
:
],
uint32
(
int32
((
*
a
)
.
NodeState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
6
:
],
uint32
(
int32
((
*
a
)
.
NodeState
)))
float64_NEOEncode
(
data
[
10
:
],
(
*
a
)
.
IdTimestamp
)
float64_NEOEncode
(
data
[
10
:
],
(
*
a
)
.
IdTimestamp
)
data
=
data
[
18
:
]
data
=
data
[
18
:
]
nwrote
+=
18
}
}
}
}
}
}
...
@@ -1994,6 +2454,11 @@ overflow:
...
@@ -1994,6 +2454,11 @@ overflow:
// 61. SetNodeState
// 61. SetNodeState
func
(
p
*
SetNodeState
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
SetNodeState
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
SetNodeState
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
NodeState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
NodeState
)))
...
@@ -2012,17 +2477,29 @@ overflow:
...
@@ -2012,17 +2477,29 @@ overflow:
// 62. AddPendingNodes
// 62. AddPendingNodes
func
(
p
*
AddPendingNodes
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
UUIDList
))
size
+=
0
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
_
=
a
size
+=
4
}
}
return
int
(
size
)
+
0
}
func
(
p
*
AddPendingNodes
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AddPendingNodes
)
NEOEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
UUIDList
))
l
:=
uint32
(
len
(
p
.
UUIDList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
a
:=
&
p
.
UUIDList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
))))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
))))
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
}
}
}
}
}
}
...
@@ -2050,17 +2527,29 @@ overflow:
...
@@ -2050,17 +2527,29 @@ overflow:
// 63. TweakPartitionTable
// 63. TweakPartitionTable
func
(
p
*
TweakPartitionTable
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
UUIDList
))
size
+=
0
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
_
=
a
size
+=
4
}
}
return
int
(
size
)
+
0
}
func
(
p
*
TweakPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TweakPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
UUIDList
))
l
:=
uint32
(
len
(
p
.
UUIDList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
a
:=
&
p
.
UUIDList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
))))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
))))
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
}
}
}
}
}
}
...
@@ -2088,12 +2577,29 @@ overflow:
...
@@ -2088,12 +2577,29 @@ overflow:
// 64. NotifyNodeInformation
// 64. NotifyNodeInformation
func
(
p
*
NotifyNodeInformation
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
NodeList
))
size
+=
0
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
NodeList
[
i
]
{
l
:=
uint32
(
len
((
*
a
)
.
Address
.
Host
))
size
+=
8
+
l
}
_
=
a
size
+=
18
}
}
return
int
(
size
)
+
0
}
func
(
p
*
NotifyNodeInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyNodeInformation
)
NEOEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
l
:=
uint32
(
len
(
p
.
NodeList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
NodeList
[
i
]
a
:=
&
p
.
NodeList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
NodeType
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
NodeType
)))
...
@@ -2101,18 +2607,13 @@ func (p *NotifyNodeInformation) NEOEncode(data []byte) {
...
@@ -2101,18 +2607,13 @@ func (p *NotifyNodeInformation) NEOEncode(data []byte) {
l
:=
uint32
(
len
((
*
a
)
.
Address
.
Host
))
l
:=
uint32
(
len
((
*
a
)
.
Address
.
Host
))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
nwrote
+=
8
+
l
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
6
:
],
uint32
(
int32
((
*
a
)
.
NodeState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
6
:
],
uint32
(
int32
((
*
a
)
.
NodeState
)))
float64_NEOEncode
(
data
[
10
:
],
(
*
a
)
.
IdTimestamp
)
float64_NEOEncode
(
data
[
10
:
],
(
*
a
)
.
IdTimestamp
)
data
=
data
[
18
:
]
data
=
data
[
18
:
]
nwrote
+=
18
}
}
}
}
}
}
...
@@ -2154,6 +2655,11 @@ overflow:
...
@@ -2154,6 +2655,11 @@ overflow:
// 65. NodeInformation
// 65. NodeInformation
func
(
p
*
NodeInformation
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
NodeInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NodeInformation
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -2168,6 +2674,11 @@ overflow:
...
@@ -2168,6 +2674,11 @@ overflow:
// 66. SetClusterState
// 66. SetClusterState
func
(
p
*
SetClusterState
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
4
}
func
(
p
*
SetClusterState
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
SetClusterState
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
}
}
...
@@ -2184,6 +2695,11 @@ overflow:
...
@@ -2184,6 +2695,11 @@ overflow:
// 67. ClusterInformation
// 67. ClusterInformation
func
(
p
*
ClusterInformation
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
4
}
func
(
p
*
ClusterInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ClusterInformation
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
}
}
...
@@ -2200,6 +2716,11 @@ overflow:
...
@@ -2200,6 +2716,11 @@ overflow:
// 68. X_ClusterState
// 68. X_ClusterState
func
(
p
*
X_ClusterState
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
4
}
func
(
p
*
X_ClusterState
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
X_ClusterState
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
}
}
...
@@ -2216,6 +2737,20 @@ overflow:
...
@@ -2216,6 +2737,20 @@ overflow:
// 69. ObjectUndoSerial
// 69. ObjectUndoSerial
func
(
p
*
ObjectUndoSerial
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
OidList
))
size
+=
24
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
_
=
a
size
+=
8
}
}
return
int
(
size
)
+
0
}
func
(
p
*
ObjectUndoSerial
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ObjectUndoSerial
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
LTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
LTID
))
...
@@ -2224,12 +2759,10 @@ func (p *ObjectUndoSerial) NEOEncode(data []byte) {
...
@@ -2224,12 +2759,10 @@ func (p *ObjectUndoSerial) NEOEncode(data []byte) {
l
:=
uint32
(
len
(
p
.
OidList
))
l
:=
uint32
(
len
(
p
.
OidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
24
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
24
:
],
l
)
data
=
data
[
28
:
]
data
=
data
[
28
:
]
nwrote
+=
28
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
:=
&
p
.
OidList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
}
}
}
}
}
}
...
@@ -2260,6 +2793,12 @@ overflow:
...
@@ -2260,6 +2793,12 @@ overflow:
// 70. AnswerObjectUndoSerial
// 70. AnswerObjectUndoSerial
func
(
p
*
AnswerObjectUndoSerial
)
NEOEncodedLen
()
int
{
var
size
uint32
// TODO map
return
int
(
size
)
+
0
}
func
(
p
*
AnswerObjectUndoSerial
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerObjectUndoSerial
)
NEOEncode
(
data
[]
byte
)
{
// TODO map
// TODO map
}
}
...
@@ -2300,6 +2839,11 @@ overflow:
...
@@ -2300,6 +2839,11 @@ overflow:
// 71. HasLock
// 71. HasLock
func
(
p
*
HasLock
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
16
}
func
(
p
*
HasLock
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
HasLock
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Oid
))
...
@@ -2318,6 +2862,11 @@ overflow:
...
@@ -2318,6 +2862,11 @@ overflow:
// 72. AnswerHasLock
// 72. AnswerHasLock
func
(
p
*
AnswerHasLock
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
12
}
func
(
p
*
AnswerHasLock
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerHasLock
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
uint32
(
int32
(
p
.
LockState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
uint32
(
int32
(
p
.
LockState
)))
...
@@ -2336,6 +2885,11 @@ overflow:
...
@@ -2336,6 +2885,11 @@ overflow:
// 73. CheckCurrentSerial
// 73. CheckCurrentSerial
func
(
p
*
CheckCurrentSerial
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
24
}
func
(
p
*
CheckCurrentSerial
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckCurrentSerial
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Serial
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Serial
))
...
@@ -2356,6 +2910,11 @@ overflow:
...
@@ -2356,6 +2910,11 @@ overflow:
// 74. AnswerCheckCurrentSerial
// 74. AnswerCheckCurrentSerial
func
(
p
*
AnswerCheckCurrentSerial
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
17
}
func
(
p
*
AnswerCheckCurrentSerial
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerCheckCurrentSerial
)
NEOEncode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Conflicting
)
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Conflicting
)
binary
.
BigEndian
.
PutUint64
(
data
[
1
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
1
:
],
uint64
(
p
.
Oid
))
...
@@ -2376,6 +2935,11 @@ overflow:
...
@@ -2376,6 +2935,11 @@ overflow:
// 75. Pack
// 75. Pack
func
(
p
*
Pack
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
Pack
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Pack
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
...
@@ -2392,6 +2956,11 @@ overflow:
...
@@ -2392,6 +2956,11 @@ overflow:
// 76. AnswerPack
// 76. AnswerPack
func
(
p
*
AnswerPack
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
1
}
func
(
p
*
AnswerPack
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPack
)
NEOEncode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Status
)
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Status
)
}
}
...
@@ -2408,6 +2977,12 @@ overflow:
...
@@ -2408,6 +2977,12 @@ overflow:
// 77. CheckReplicas
// 77. CheckReplicas
func
(
p
*
CheckReplicas
)
NEOEncodedLen
()
int
{
var
size
uint32
// TODO map
return
int
(
size
)
+
16
}
func
(
p
*
CheckReplicas
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckReplicas
)
NEOEncode
(
data
[]
byte
)
{
// TODO map
// TODO map
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
MinTID
))
...
@@ -2440,27 +3015,32 @@ overflow:
...
@@ -2440,27 +3015,32 @@ overflow:
// 78. CheckPartition
// 78. CheckPartition
func
(
p
*
CheckPartition
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
Source
.
UpstreamName
))
size
+=
8
+
l
}
{
l
:=
uint32
(
len
(
p
.
Source
.
Address
.
Host
))
size
+=
4
+
l
}
return
int
(
size
)
+
18
}
func
(
p
*
CheckPartition
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckPartition
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
{
{
l
:=
uint32
(
len
(
p
.
Source
.
UpstreamName
))
l
:=
uint32
(
len
(
p
.
Source
.
UpstreamName
))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Source
.
UpstreamName
)
copy
(
data
,
p
.
Source
.
UpstreamName
)
nwrote
+=
8
+
l
}
}
{
{
l
:=
uint32
(
len
(
p
.
Source
.
Address
.
Host
))
l
:=
uint32
(
len
(
p
.
Source
.
Address
.
Host
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
copy
(
data
,
p
.
Source
.
Address
.
Host
)
copy
(
data
,
p
.
Source
.
Address
.
Host
)
nwrote
+=
4
+
l
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Source
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Source
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint64
(
data
[
2
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
2
:
],
uint64
(
p
.
MinTID
))
...
@@ -2502,6 +3082,11 @@ overflow:
...
@@ -2502,6 +3082,11 @@ overflow:
// 79. CheckTIDRange
// 79. CheckTIDRange
func
(
p
*
CheckTIDRange
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
24
}
func
(
p
*
CheckTIDRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckTIDRange
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
p
.
Length
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
p
.
Length
)
...
@@ -2524,6 +3109,11 @@ overflow:
...
@@ -2524,6 +3109,11 @@ overflow:
// 80. AnswerCheckTIDRange
// 80. AnswerCheckTIDRange
func
(
p
*
AnswerCheckTIDRange
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
32
}
func
(
p
*
AnswerCheckTIDRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerCheckTIDRange
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Count
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Count
)
(
data
[
4
:
])[
0
]
=
p
.
Checksum
[
0
]
(
data
[
4
:
])[
0
]
=
p
.
Checksum
[
0
]
...
@@ -2582,6 +3172,11 @@ overflow:
...
@@ -2582,6 +3172,11 @@ overflow:
// 81. CheckSerialRange
// 81. CheckSerialRange
func
(
p
*
CheckSerialRange
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
32
}
func
(
p
*
CheckSerialRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckSerialRange
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
p
.
Length
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
p
.
Length
)
...
@@ -2606,6 +3201,11 @@ overflow:
...
@@ -2606,6 +3201,11 @@ overflow:
// 82. AnswerCheckSerialRange
// 82. AnswerCheckSerialRange
func
(
p
*
AnswerCheckSerialRange
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
60
}
func
(
p
*
AnswerCheckSerialRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerCheckSerialRange
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Count
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Count
)
(
data
[
4
:
])[
0
]
=
p
.
TidChecksum
[
0
]
(
data
[
4
:
])[
0
]
=
p
.
TidChecksum
[
0
]
...
@@ -2706,18 +3306,30 @@ overflow:
...
@@ -2706,18 +3306,30 @@ overflow:
// 83. PartitionCorrupted
// 83. PartitionCorrupted
func
(
p
*
PartitionCorrupted
)
NEOEncodedLen
()
int
{
var
size
uint32
{
l
:=
uint32
(
len
(
p
.
CellList
))
size
+=
4
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
_
=
a
size
+=
4
}
}
return
int
(
size
)
+
0
}
func
(
p
*
PartitionCorrupted
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PartitionCorrupted
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
{
{
l
:=
uint32
(
len
(
p
.
CellList
))
l
:=
uint32
(
len
(
p
.
CellList
))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nwrote
+=
8
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
a
:=
&
p
.
CellList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
))))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
))))
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nwrote
+=
4
}
}
}
}
}
}
...
@@ -2746,6 +3358,11 @@ overflow:
...
@@ -2746,6 +3358,11 @@ overflow:
// 84. LastTransaction
// 84. LastTransaction
func
(
p
*
LastTransaction
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
LastTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LastTransaction
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
@@ -2760,6 +3377,11 @@ overflow:
...
@@ -2760,6 +3377,11 @@ overflow:
// 85. AnswerLastTransaction
// 85. AnswerLastTransaction
func
(
p
*
AnswerLastTransaction
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
8
}
func
(
p
*
AnswerLastTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLastTransaction
)
NEOEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
...
@@ -2776,6 +3398,11 @@ overflow:
...
@@ -2776,6 +3398,11 @@ overflow:
// 86. NotifyReady
// 86. NotifyReady
func
(
p
*
NotifyReady
)
NEOEncodedLen
()
int
{
var
size
uint32
return
int
(
size
)
+
0
}
func
(
p
*
NotifyReady
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyReady
)
NEOEncode
(
data
[]
byte
)
{
}
}
...
...
t/neo/protogen.go
View file @
dd43cd5b
...
@@ -116,6 +116,7 @@ import (
...
@@ -116,6 +116,7 @@ import (
fmt
.
Fprintf
(
&
buf
,
"// %d. %s
\n\n
"
,
pktCode
,
typename
)
fmt
.
Fprintf
(
&
buf
,
"// %d. %s
\n\n
"
,
pktCode
,
typename
)
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
encoder
{
SizeOnly
:
true
}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
encoder
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
encoder
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
decoder
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
decoder
{}))
...
@@ -193,6 +194,7 @@ type CodecCodeGen interface {
...
@@ -193,6 +194,7 @@ type CodecCodeGen interface {
type
encoder
struct
{
type
encoder
struct
{
Buffer
// XXX
Buffer
// XXX
n
int
n
int
SizeOnly
bool
// generate code only to compute encoded size
}
}
type
decoder
struct
{
type
decoder
struct
{
...
@@ -212,8 +214,12 @@ func (d *decoder) generatedCode() string {
...
@@ -212,8 +214,12 @@ func (d *decoder) generatedCode() string {
}
}
func
(
e
*
encoder
)
genPrologue
(
recvName
,
typeName
string
)
{
func
(
e
*
encoder
)
genPrologue
(
recvName
,
typeName
string
)
{
if
e
.
SizeOnly
{
e
.
emit
(
"func (%s *%s) NEOEncodedLen() int {"
,
recvName
,
typeName
)
e
.
emit
(
"var size uint32"
)
}
else
{
e
.
emit
(
"func (%s *%s) NEOEncode(data []byte) {"
,
recvName
,
typeName
)
e
.
emit
(
"func (%s *%s) NEOEncode(data []byte) {"
,
recvName
,
typeName
)
//e.emit("var nwrote uint32")
}
}
}
func
(
d
*
decoder
)
genPrologue
(
recvName
,
typeName
string
)
{
func
(
d
*
decoder
)
genPrologue
(
recvName
,
typeName
string
)
{
...
@@ -222,10 +228,9 @@ func (d *decoder) genPrologue(recvName, typeName string) {
...
@@ -222,10 +228,9 @@ func (d *decoder) genPrologue(recvName, typeName string) {
}
}
func
(
e
*
encoder
)
genEpilogue
()
{
func
(
e
*
encoder
)
genEpilogue
()
{
//e.emit("return int(nwrote) + %v /*, nil*/", e.n)
if
e
.
SizeOnly
{
//e.emit("\noverflow:")
e
.
emit
(
"return int(size) + %v"
,
e
.
n
)
//e.emit("panic(0) //return 0, ErrEncodeOverflow")
}
//e.emit("goto overflow") // TODO remove
e
.
emit
(
"}
\n
"
)
e
.
emit
(
"}
\n
"
)
}
}
...
@@ -247,9 +252,11 @@ func (e *encoder) genBasic(path string, typ *types.Basic, userType types.Type, o
...
@@ -247,9 +252,11 @@ func (e *encoder) genBasic(path string, typ *types.Basic, userType types.Type, o
path
=
fmt
.
Sprintf
(
"%v(%v)"
,
typeName
(
typ
),
path
)
path
=
fmt
.
Sprintf
(
"%v(%v)"
,
typeName
(
typ
),
path
)
}
}
e
.
n
+=
basic
.
wireSize
e
.
n
+=
basic
.
wireSize
if
!
e
.
SizeOnly
{
// NOTE no space before "=" - to be able to merge with ":"
// NOTE no space before "=" - to be able to merge with ":"
// prefix and become defining assignment
// prefix and become defining assignment
e
.
emit
(
basic
.
encode
,
dataptr
,
path
)
e
.
emit
(
basic
.
encode
,
dataptr
,
path
)
}
}
}
func
(
d
*
decoder
)
genBasic
(
assignto
string
,
typ
*
types
.
Basic
,
userType
types
.
Type
,
obj
types
.
Object
)
{
func
(
d
*
decoder
)
genBasic
(
assignto
string
,
typ
*
types
.
Basic
,
userType
types
.
Type
,
obj
types
.
Object
)
{
...
@@ -276,10 +283,12 @@ func (e *encoder) genStrBytes(path string) {
...
@@ -276,10 +283,12 @@ func (e *encoder) genStrBytes(path string) {
e
.
emit
(
"{"
)
e
.
emit
(
"{"
)
e
.
emit
(
"l := uint32(len(%s))"
,
path
)
e
.
emit
(
"l := uint32(len(%s))"
,
path
)
e
.
genBasic
(
"l"
,
types
.
Typ
[
types
.
Uint32
],
nil
,
nil
)
e
.
genBasic
(
"l"
,
types
.
Typ
[
types
.
Uint32
],
nil
,
nil
)
if
!
e
.
SizeOnly
{
e
.
emit
(
"data = data[%v:]"
,
e
.
n
)
e
.
emit
(
"data = data[%v:]"
,
e
.
n
)
e
.
emit
(
"if uint32(len(data)) < l { goto overflow }"
)
e
.
emit
(
"copy(data, %v)"
,
path
)
e
.
emit
(
"copy(data, %v)"
,
path
)
e
.
emit
(
"nwrote += %v + l"
,
e
.
n
)
}
else
{
e
.
emit
(
"size += %v + l"
,
e
.
n
)
}
e
.
emit
(
"}"
)
e
.
emit
(
"}"
)
e
.
n
=
0
e
.
n
=
0
}
}
...
@@ -303,17 +312,23 @@ func (d *decoder) genStrBytes(assignto string) {
...
@@ -303,17 +312,23 @@ func (d *decoder) genStrBytes(assignto string) {
func
(
e
*
encoder
)
genSlice
(
path
string
,
typ
*
types
.
Slice
,
obj
types
.
Object
)
{
func
(
e
*
encoder
)
genSlice
(
path
string
,
typ
*
types
.
Slice
,
obj
types
.
Object
)
{
e
.
emit
(
"{"
)
e
.
emit
(
"{"
)
e
.
emit
(
"l := uint32(len(%s))"
,
path
)
e
.
emit
(
"l := uint32(len(%s))"
,
path
)
if
!
e
.
SizeOnly
{
e
.
genBasic
(
"l"
,
types
.
Typ
[
types
.
Uint32
],
nil
,
nil
)
e
.
genBasic
(
"l"
,
types
.
Typ
[
types
.
Uint32
],
nil
,
nil
)
e
.
emit
(
"data = data[%v:]"
,
e
.
n
)
e
.
emit
(
"data = data[%v:]"
,
e
.
n
)
e
.
emit
(
"nwrote += %v"
,
e
.
n
)
}
else
{
e
.
emit
(
"size += %v"
,
e
.
n
)
}
e
.
n
=
0
e
.
n
=
0
// TODO size check
// TODO if size(item)==const - size update in one go
// TODO if size(item)==const - check l in one go
e
.
emit
(
"for i := 0; uint32(i) <l; i++ {"
)
e
.
emit
(
"for i := 0; uint32(i) <l; i++ {"
)
e
.
emit
(
"a := &%s[i]"
,
path
)
e
.
emit
(
"a := &%s[i]"
,
path
)
codegenType
(
"(*a)"
,
typ
.
Elem
(),
obj
,
e
)
codegenType
(
"(*a)"
,
typ
.
Elem
(),
obj
,
e
)
if
!
e
.
SizeOnly
{
e
.
emit
(
"data = data[%v:]"
,
e
.
n
)
// FIXME wrt slice of slice ?
e
.
emit
(
"data = data[%v:]"
,
e
.
n
)
// FIXME wrt slice of slice ?
e
.
emit
(
"nwrote += %v"
,
e
.
n
)
}
else
{
e
.
emit
(
"_ = a"
)
// FIXME try to remove
e
.
emit
(
"size += %v"
,
e
.
n
)
}
e
.
emit
(
"}"
)
e
.
emit
(
"}"
)
// see vvv
// see vvv
e
.
emit
(
"}"
)
e
.
emit
(
"}"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment