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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
65ff3185
Commit
65ff3185
authored
Jun 07, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c6dda6c2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
812 additions
and
430 deletions
+812
-430
go/neo/connection.go
go/neo/connection.go
+1
-1
go/neo/master.go
go/neo/master.go
+3
-3
go/neo/pkt.go
go/neo/pkt.go
+6
-4
go/neo/proto-marshal.go
go/neo/proto-marshal.go
+728
-364
go/neo/proto.go
go/neo/proto.go
+30
-17
go/neo/proto_test.go
go/neo/proto_test.go
+12
-11
go/neo/protogen.go
go/neo/protogen.go
+17
-17
go/neo/server.go
go/neo/server.go
+13
-11
go/neo/storage.go
go/neo/storage.go
+2
-2
No files found.
go/neo/connection.go
View file @
65ff3185
...
@@ -200,7 +200,7 @@ func (nl *NodeLink) NewConn() (*Conn, error) {
...
@@ -200,7 +200,7 @@ func (nl *NodeLink) NewConn() (*Conn, error) {
}
}
// shutdown closes peerLink and marks NodeLink as no longer operational
// shutdown closes peerLink and marks NodeLink as no longer operational
// it also shutdowns a
nd a
ll opened connections over this node link.
// it also shutdowns all opened connections over this node link.
func
(
nl
*
NodeLink
)
shutdown
()
{
func
(
nl
*
NodeLink
)
shutdown
()
{
nl
.
downOnce
.
Do
(
func
()
{
nl
.
downOnce
.
Do
(
func
()
{
close
(
nl
.
down
)
close
(
nl
.
down
)
...
...
go/neo/master.go
View file @
65ff3185
...
@@ -67,7 +67,7 @@ type Master struct {
...
@@ -67,7 +67,7 @@ type Master struct {
type
nodeCome
struct
{
type
nodeCome
struct
{
link
*
NodeLink
link
*
NodeLink
idReq
RequestIdentification
// we received this identification request
idReq
RequestIdentification
// we received this identification request
idResp
chan
NEO
Encoder
// what we reply (AcceptIdentification | Error)
idResp
chan
NEO
Pkt
// what we reply (AcceptIdentification | Error)
}
}
// node disconnects
// node disconnects
...
@@ -704,7 +704,7 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
...
@@ -704,7 +704,7 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
}
}
// convey identification request to master
// convey identification request to master
idRespCh
:=
make
(
chan
NEO
Encoder
)
idRespCh
:=
make
(
chan
NEO
Pkt
)
m
.
nodeCome
<-
nodeCome
{
link
,
idReq
,
idRespCh
}
m
.
nodeCome
<-
nodeCome
{
link
,
idReq
,
idRespCh
}
idResp
:=
<-
idRespCh
idResp
:=
<-
idRespCh
...
@@ -760,7 +760,7 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
...
@@ -760,7 +760,7 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
m
.
stateMu
.
Unlock
()
m
.
stateMu
.
Unlock
()
go
func
()
{
go
func
()
{
var
pkt
NEO
Encoder
var
pkt
NEO
Pkt
for
{
for
{
select
{
select
{
...
...
go/neo/pkt.go
View file @
65ff3185
...
@@ -25,11 +25,12 @@ import (
...
@@ -25,11 +25,12 @@ import (
// TODO organize rx buffers management (freelist etc)
// TODO organize rx buffers management (freelist etc)
//
Buffer with packet data
//
PktBuf is a buffer with full raw packet (header + data)
type
PktBuf
struct
{
type
PktBuf
struct
{
Data
[]
byte
// whole packet data including all headers XXX -> Buf ?
Data
[]
byte
// whole packet data including all headers XXX -> Buf ?
}
}
// PktHead represents header of a raw packet
// XXX naming -> PktHeader ?
// XXX naming -> PktHeader ?
type
PktHead
struct
{
type
PktHead
struct
{
ConnId
be32
// NOTE is .msgid in py
ConnId
be32
// NOTE is .msgid in py
...
@@ -37,19 +38,20 @@ type PktHead struct {
...
@@ -37,19 +38,20 @@ type PktHead struct {
MsgLen
be32
// payload message length (excluding packet header)
MsgLen
be32
// payload message length (excluding packet header)
}
}
//
Get
pointer to packet header
//
Header returns
pointer to packet header
func
(
pkt
*
PktBuf
)
Header
()
*
PktHead
{
func
(
pkt
*
PktBuf
)
Header
()
*
PktHead
{
// XXX check len(Data) < PktHead ? -> no, Data has to be allocated with cap >= PktHeadLen
// XXX check len(Data) < PktHead ? -> no, Data has to be allocated with cap >= PktHeadLen
return
(
*
PktHead
)(
unsafe
.
Pointer
(
&
pkt
.
Data
[
0
]))
return
(
*
PktHead
)(
unsafe
.
Pointer
(
&
pkt
.
Data
[
0
]))
}
}
//
Get
packet payload
//
Payload returns []byte representing
packet payload
func
(
pkt
*
PktBuf
)
Payload
()
[]
byte
{
func
(
pkt
*
PktBuf
)
Payload
()
[]
byte
{
return
pkt
.
Data
[
PktHeadLen
:
]
return
pkt
.
Data
[
PktHeadLen
:
]
}
}
// packet dumping
// Strings dumps a packet
// XXX -> use .Dump() for full dump?
func
(
pkt
*
PktBuf
)
String
()
string
{
func
(
pkt
*
PktBuf
)
String
()
string
{
if
len
(
pkt
.
Data
)
<
PktHeadLen
{
if
len
(
pkt
.
Data
)
<
PktHeadLen
{
return
fmt
.
Sprintf
(
"(! < PktHeadLen) % x"
,
pkt
.
Data
)
return
fmt
.
Sprintf
(
"(! < PktHeadLen) % x"
,
pkt
.
Data
)
...
...
go/neo/proto-marshal.go
View file @
65ff3185
...
@@ -14,11 +14,15 @@ import (
...
@@ -14,11 +14,15 @@ import (
// 0. Address
// 0. Address
func
(
p
*
Address
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
Address
)
NEOPktMsgCode
()
uint16
{
return
0
,
6
+
len
(
p
.
Host
)
return
0
}
}
func
(
p
*
Address
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Address
)
NEOPktEncodedLen
()
int
{
return
6
+
len
(
p
.
Host
)
}
func
(
p
*
Address
)
NEOPktEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
Host
))
l
:=
uint32
(
len
(
p
.
Host
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -29,7 +33,7 @@ func (p *Address) NEOEncode(data []byte) {
...
@@ -29,7 +33,7 @@ func (p *Address) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Port
)
}
}
func
(
p
*
Address
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Address
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -53,11 +57,15 @@ overflow:
...
@@ -53,11 +57,15 @@ overflow:
// 1. NodeInfo
// 1. NodeInfo
func
(
p
*
NodeInfo
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
NodeInfo
)
NEOPktMsgCode
()
uint16
{
return
1
,
26
+
len
(
p
.
Address
.
Host
)
return
1
}
func
(
p
*
NodeInfo
)
NEOPktEncodedLen
()
int
{
return
26
+
len
(
p
.
Address
.
Host
)
}
}
func
(
p
*
NodeInfo
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NodeInfo
)
NEO
Pkt
Encode
(
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
))
...
@@ -72,7 +80,7 @@ func (p *NodeInfo) NEOEncode(data []byte) {
...
@@ -72,7 +80,7 @@ func (p *NodeInfo) NEOEncode(data []byte) {
float64_NEOEncode
(
data
[
10
:
],
p
.
IdTimestamp
)
float64_NEOEncode
(
data
[
10
:
],
p
.
IdTimestamp
)
}
}
func
(
p
*
NodeInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NodeInfo
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
...
@@ -100,16 +108,20 @@ overflow:
...
@@ -100,16 +108,20 @@ overflow:
// 2. CellInfo
// 2. CellInfo
func
(
p
*
CellInfo
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
CellInfo
)
NEOPktMsgCode
()
uint16
{
return
2
,
8
return
2
}
func
(
p
*
CellInfo
)
NEOPktEncodedLen
()
int
{
return
8
}
}
func
(
p
*
CellInfo
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CellInfo
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
CellState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
CellState
)))
}
}
func
(
p
*
CellInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CellInfo
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -123,11 +135,15 @@ overflow:
...
@@ -123,11 +135,15 @@ overflow:
// 3. RowInfo
// 3. RowInfo
func
(
p
*
RowInfo
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
RowInfo
)
NEOPktMsgCode
()
uint16
{
return
3
,
8
+
len
(
p
.
CellList
)
*
8
return
3
}
}
func
(
p
*
RowInfo
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RowInfo
)
NEOPktEncodedLen
()
int
{
return
8
+
len
(
p
.
CellList
)
*
8
}
func
(
p
*
RowInfo
)
NEOPktEncode
(
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
))
...
@@ -142,7 +158,7 @@ func (p *RowInfo) NEOEncode(data []byte) {
...
@@ -142,7 +158,7 @@ func (p *RowInfo) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
RowInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RowInfo
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
...
@@ -171,11 +187,15 @@ overflow:
...
@@ -171,11 +187,15 @@ overflow:
// 4. Error
// 4. Error
func
(
p
*
Error
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
Error
)
NEOPktMsgCode
()
uint16
{
return
4
,
8
+
len
(
p
.
Message
)
return
4
}
func
(
p
*
Error
)
NEOPktEncodedLen
()
int
{
return
8
+
len
(
p
.
Message
)
}
}
func
(
p
*
Error
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Error
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
p
.
Code
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
p
.
Code
))
{
{
l
:=
uint32
(
len
(
p
.
Message
))
l
:=
uint32
(
len
(
p
.
Message
))
...
@@ -186,7 +206,7 @@ func (p *Error) NEOEncode(data []byte) {
...
@@ -186,7 +206,7 @@ func (p *Error) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
Error
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Error
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
...
@@ -210,37 +230,49 @@ overflow:
...
@@ -210,37 +230,49 @@ overflow:
// 5. Ping
// 5. Ping
func
(
p
*
Ping
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
Ping
)
NEOPktMsgCode
()
uint16
{
return
5
,
0
return
5
}
func
(
p
*
Ping
)
NEOPktEncodedLen
()
int
{
return
0
}
}
func
(
p
*
Ping
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Ping
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
}
}
func
(
p
*
Ping
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Ping
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
return
0
,
nil
}
}
// 6. CloseClient
// 6. CloseClient
func
(
p
*
CloseClient
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
CloseClient
)
NEOPktMsgCode
()
uint16
{
return
6
,
0
return
6
}
}
func
(
p
*
CloseClient
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CloseClient
)
NEOPktEncodedLen
()
int
{
return
0
}
}
func
(
p
*
CloseClient
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CloseClient
)
NEOPktEncode
(
data
[]
byte
)
{
}
func
(
p
*
CloseClient
)
NEOPktDecode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
return
0
,
nil
}
}
// 7. RequestIdentification
// 7. RequestIdentification
func
(
p
*
RequestIdentification
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
RequestIdentification
)
NEOPktMsgCode
()
uint16
{
return
7
,
26
+
len
(
p
.
Address
.
Host
)
+
len
(
p
.
ClusterName
)
return
7
}
func
(
p
*
RequestIdentification
)
NEOPktEncodedLen
()
int
{
return
26
+
len
(
p
.
Address
.
Host
)
+
len
(
p
.
ClusterName
)
}
}
func
(
p
*
RequestIdentification
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RequestIdentification
)
NEO
Pkt
Encode
(
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
.
NodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
NodeUUID
)))
{
{
...
@@ -261,7 +293,7 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
...
@@ -261,7 +293,7 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
float64_NEOEncode
(
data
[
0
:
],
p
.
IdTimestamp
)
float64_NEOEncode
(
data
[
0
:
],
p
.
IdTimestamp
)
}
}
func
(
p
*
RequestIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RequestIdentification
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -298,11 +330,15 @@ overflow:
...
@@ -298,11 +330,15 @@ overflow:
// 8. AcceptIdentification
// 8. AcceptIdentification
func
(
p
*
AcceptIdentification
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AcceptIdentification
)
NEOPktMsgCode
()
uint16
{
return
8
,
20
return
8
}
func
(
p
*
AcceptIdentification
)
NEOPktEncodedLen
()
int
{
return
20
}
}
func
(
p
*
AcceptIdentification
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AcceptIdentification
)
NEO
Pkt
Encode
(
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
.
MyNodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
MyNodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
p
.
NumPartitions
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
p
.
NumPartitions
)
...
@@ -310,7 +346,7 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
...
@@ -310,7 +346,7 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
16
:
],
uint32
(
int32
(
p
.
YourNodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
16
:
],
uint32
(
int32
(
p
.
YourNodeUUID
)))
}
}
func
(
p
*
AcceptIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AcceptIdentification
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
20
{
if
uint32
(
len
(
data
))
<
20
{
goto
overflow
goto
overflow
}
}
...
@@ -327,28 +363,36 @@ overflow:
...
@@ -327,28 +363,36 @@ overflow:
// 9. PrimaryMaster
// 9. PrimaryMaster
func
(
p
*
PrimaryMaster
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
PrimaryMaster
)
NEOPktMsgCode
()
uint16
{
return
9
,
0
return
9
}
}
func
(
p
*
PrimaryMaster
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PrimaryMaster
)
NEOPktEncodedLen
()
int
{
return
0
}
}
func
(
p
*
PrimaryMaster
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
PrimaryMaster
)
NEOPktEncode
(
data
[]
byte
)
{
}
func
(
p
*
PrimaryMaster
)
NEOPktDecode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
return
0
,
nil
}
}
// 10. AnswerPrimary
// 10. AnswerPrimary
func
(
p
*
AnswerPrimary
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerPrimary
)
NEOPktMsgCode
()
uint16
{
return
10
,
4
return
10
}
}
func
(
p
*
AnswerPrimary
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPrimary
)
NEOPktEncodedLen
()
int
{
return
4
}
func
(
p
*
AnswerPrimary
)
NEOPktEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
PrimaryNodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
PrimaryNodeUUID
)))
}
}
func
(
p
*
AnswerPrimary
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPrimary
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
}
}
...
@@ -361,16 +405,20 @@ overflow:
...
@@ -361,16 +405,20 @@ overflow:
// 11. NotPrimaryMaster
// 11. NotPrimaryMaster
func
(
p
*
NotPrimaryMaster
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
NotPrimaryMaster
)
NEOPktMsgCode
()
uint16
{
return
11
}
func
(
p
*
NotPrimaryMaster
)
NEOPktEncodedLen
()
int
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
KnownMasterList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
KnownMasterList
);
i
++
{
a
:=
&
p
.
KnownMasterList
[
i
]
a
:=
&
p
.
KnownMasterList
[
i
]
size
+=
len
((
*
a
)
.
Address
.
Host
)
size
+=
len
((
*
a
)
.
Address
.
Host
)
}
}
return
11
,
8
+
len
(
p
.
KnownMasterList
)
*
6
+
size
return
8
+
len
(
p
.
KnownMasterList
)
*
6
+
size
}
}
func
(
p
*
NotPrimaryMaster
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotPrimaryMaster
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
Primary
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
Primary
)))
{
{
l
:=
uint32
(
len
(
p
.
KnownMasterList
))
l
:=
uint32
(
len
(
p
.
KnownMasterList
))
...
@@ -391,7 +439,7 @@ func (p *NotPrimaryMaster) NEOEncode(data []byte) {
...
@@ -391,7 +439,7 @@ func (p *NotPrimaryMaster) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
NotPrimaryMaster
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotPrimaryMaster
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
...
@@ -429,30 +477,38 @@ overflow:
...
@@ -429,30 +477,38 @@ overflow:
// 12. Recovery
// 12. Recovery
func
(
p
*
Recovery
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
Recovery
)
NEOPktMsgCode
()
uint16
{
return
12
,
0
return
12
}
func
(
p
*
Recovery
)
NEOPktEncodedLen
()
int
{
return
0
}
}
func
(
p
*
Recovery
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Recovery
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
}
}
func
(
p
*
Recovery
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Recovery
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
return
0
,
nil
}
}
// 13. AnswerRecovery
// 13. AnswerRecovery
func
(
p
*
AnswerRecovery
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerRecovery
)
NEOPktMsgCode
()
uint16
{
return
13
,
24
return
13
}
}
func
(
p
*
AnswerRecovery
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerRecovery
)
NEOPktEncodedLen
()
int
{
return
24
}
func
(
p
*
AnswerRecovery
)
NEOPktEncode
(
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
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
TruncateTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
TruncateTid
))
}
}
func
(
p
*
AnswerRecovery
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerRecovery
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
...
@@ -467,29 +523,37 @@ overflow:
...
@@ -467,29 +523,37 @@ overflow:
// 14. LastIDs
// 14. LastIDs
func
(
p
*
LastIDs
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
LastIDs
)
NEOPktMsgCode
()
uint16
{
return
14
,
0
return
14
}
func
(
p
*
LastIDs
)
NEOPktEncodedLen
()
int
{
return
0
}
}
func
(
p
*
LastIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LastIDs
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
}
}
func
(
p
*
LastIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
LastIDs
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
return
0
,
nil
}
}
// 15. AnswerLastIDs
// 15. AnswerLastIDs
func
(
p
*
AnswerLastIDs
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerLastIDs
)
NEOPktMsgCode
()
uint16
{
return
15
,
16
return
15
}
func
(
p
*
AnswerLastIDs
)
NEOPktEncodedLen
()
int
{
return
16
}
}
func
(
p
*
AnswerLastIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLastIDs
)
NEO
Pkt
Encode
(
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
))
}
}
func
(
p
*
AnswerLastIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLastIDs
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
...
@@ -503,29 +567,37 @@ overflow:
...
@@ -503,29 +567,37 @@ overflow:
// 16. X_PartitionTable
// 16. X_PartitionTable
func
(
p
*
X_PartitionTable
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
X_PartitionTable
)
NEOPktMsgCode
()
uint16
{
return
16
,
0
return
16
}
}
func
(
p
*
X_PartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
X_PartitionTable
)
NEOPktEncodedLen
()
int
{
return
0
}
}
func
(
p
*
X_PartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
X_PartitionTable
)
NEOPktEncode
(
data
[]
byte
)
{
}
func
(
p
*
X_PartitionTable
)
NEOPktDecode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
return
0
,
nil
}
}
// 17. AnswerPartitionTable
// 17. AnswerPartitionTable
func
(
p
*
AnswerPartitionTable
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerPartitionTable
)
NEOPktMsgCode
()
uint16
{
return
17
}
func
(
p
*
AnswerPartitionTable
)
NEOPktEncodedLen
()
int
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
size
+=
len
((
*
a
)
.
CellList
)
*
8
size
+=
len
((
*
a
)
.
CellList
)
*
8
}
}
return
1
7
,
1
2
+
len
(
p
.
RowList
)
*
8
+
size
return
12
+
len
(
p
.
RowList
)
*
8
+
size
}
}
func
(
p
*
AnswerPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPartitionTable
)
NEO
Pkt
Encode
(
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
))
...
@@ -550,7 +622,7 @@ func (p *AnswerPartitionTable) NEOEncode(data []byte) {
...
@@ -550,7 +622,7 @@ func (p *AnswerPartitionTable) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPartitionTable
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -592,16 +664,20 @@ overflow:
...
@@ -592,16 +664,20 @@ overflow:
// 18. NotifyPartitionTable
// 18. NotifyPartitionTable
func
(
p
*
NotifyPartitionTable
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
NotifyPartitionTable
)
NEOPktMsgCode
()
uint16
{
return
18
}
func
(
p
*
NotifyPartitionTable
)
NEOPktEncodedLen
()
int
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
size
+=
len
((
*
a
)
.
CellList
)
*
8
size
+=
len
((
*
a
)
.
CellList
)
*
8
}
}
return
1
8
,
1
2
+
len
(
p
.
RowList
)
*
8
+
size
return
12
+
len
(
p
.
RowList
)
*
8
+
size
}
}
func
(
p
*
NotifyPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyPartitionTable
)
NEO
Pkt
Encode
(
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
))
...
@@ -626,7 +702,7 @@ func (p *NotifyPartitionTable) NEOEncode(data []byte) {
...
@@ -626,7 +702,7 @@ func (p *NotifyPartitionTable) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
NotifyPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotifyPartitionTable
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -668,11 +744,15 @@ overflow:
...
@@ -668,11 +744,15 @@ overflow:
// 19. PartitionChanges
// 19. PartitionChanges
func
(
p
*
PartitionChanges
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
PartitionChanges
)
NEOPktMsgCode
()
uint16
{
return
19
,
12
+
len
(
p
.
CellList
)
*
12
return
19
}
}
func
(
p
*
PartitionChanges
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PartitionChanges
)
NEOPktEncodedLen
()
int
{
return
12
+
len
(
p
.
CellList
)
*
12
}
func
(
p
*
PartitionChanges
)
NEOPktEncode
(
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
))
...
@@ -688,7 +768,7 @@ func (p *PartitionChanges) NEOEncode(data []byte) {
...
@@ -688,7 +768,7 @@ func (p *PartitionChanges) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
PartitionChanges
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
PartitionChanges
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -722,15 +802,19 @@ overflow:
...
@@ -722,15 +802,19 @@ overflow:
// 20. StartOperation
// 20. StartOperation
func
(
p
*
StartOperation
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
StartOperation
)
NEOPktMsgCode
()
uint16
{
return
20
,
1
return
20
}
}
func
(
p
*
StartOperation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StartOperation
)
NEOPktEncodedLen
()
int
{
return
1
}
func
(
p
*
StartOperation
)
NEOPktEncode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Backup
)
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Backup
)
}
}
func
(
p
*
StartOperation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
StartOperation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
1
{
if
uint32
(
len
(
data
))
<
1
{
goto
overflow
goto
overflow
}
}
...
@@ -743,24 +827,32 @@ overflow:
...
@@ -743,24 +827,32 @@ overflow:
// 21. StopOperation
// 21. StopOperation
func
(
p
*
StopOperation
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
StopOperation
)
NEOPktMsgCode
()
uint16
{
return
21
,
0
return
21
}
func
(
p
*
StopOperation
)
NEOPktEncodedLen
()
int
{
return
0
}
}
func
(
p
*
StopOperation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StopOperation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
}
}
func
(
p
*
StopOperation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
StopOperation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
return
0
,
nil
}
}
// 22. UnfinishedTransactions
// 22. UnfinishedTransactions
func
(
p
*
UnfinishedTransactions
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
UnfinishedTransactions
)
NEOPktMsgCode
()
uint16
{
return
22
,
4
+
len
(
p
.
RowList
)
*
4
return
22
}
func
(
p
*
UnfinishedTransactions
)
NEOPktEncodedLen
()
int
{
return
4
+
len
(
p
.
RowList
)
*
4
}
}
func
(
p
*
UnfinishedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
UnfinishedTransactions
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
RowList
))
l
:=
uint32
(
len
(
p
.
RowList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -773,7 +865,7 @@ func (p *UnfinishedTransactions) NEOEncode(data []byte) {
...
@@ -773,7 +865,7 @@ func (p *UnfinishedTransactions) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
UnfinishedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
UnfinishedTransactions
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -800,11 +892,15 @@ overflow:
...
@@ -800,11 +892,15 @@ overflow:
// 23. AnswerUnfinishedTransactions
// 23. AnswerUnfinishedTransactions
func
(
p
*
AnswerUnfinishedTransactions
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerUnfinishedTransactions
)
NEOPktMsgCode
()
uint16
{
return
23
,
12
+
len
(
p
.
TidList
)
*
8
return
23
}
}
func
(
p
*
AnswerUnfinishedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerUnfinishedTransactions
)
NEOPktEncodedLen
()
int
{
return
12
+
len
(
p
.
TidList
)
*
8
}
func
(
p
*
AnswerUnfinishedTransactions
)
NEOPktEncode
(
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
))
...
@@ -818,7 +914,7 @@ func (p *AnswerUnfinishedTransactions) NEOEncode(data []byte) {
...
@@ -818,7 +914,7 @@ func (p *AnswerUnfinishedTransactions) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerUnfinishedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerUnfinishedTransactions
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -846,24 +942,32 @@ overflow:
...
@@ -846,24 +942,32 @@ overflow:
// 24. LockedTransactions
// 24. LockedTransactions
func
(
p
*
LockedTransactions
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
LockedTransactions
)
NEOPktMsgCode
()
uint16
{
return
24
,
0
return
24
}
func
(
p
*
LockedTransactions
)
NEOPktEncodedLen
()
int
{
return
0
}
}
func
(
p
*
LockedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LockedTransactions
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
}
}
func
(
p
*
LockedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
LockedTransactions
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
return
0
,
nil
}
}
// 25. AnswerLockedTransactions
// 25. AnswerLockedTransactions
func
(
p
*
AnswerLockedTransactions
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerLockedTransactions
)
NEOPktMsgCode
()
uint16
{
return
25
,
4
+
len
(
p
.
TidDict
)
*
16
return
25
}
func
(
p
*
AnswerLockedTransactions
)
NEOPktEncodedLen
()
int
{
return
4
+
len
(
p
.
TidDict
)
*
16
}
}
func
(
p
*
AnswerLockedTransactions
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLockedTransactions
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
TidDict
))
l
:=
uint32
(
len
(
p
.
TidDict
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -881,7 +985,7 @@ func (p *AnswerLockedTransactions) NEOEncode(data []byte) {
...
@@ -881,7 +985,7 @@ func (p *AnswerLockedTransactions) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerLockedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLockedTransactions
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -909,15 +1013,19 @@ overflow:
...
@@ -909,15 +1013,19 @@ overflow:
// 26. FinalTID
// 26. FinalTID
func
(
p
*
FinalTID
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
FinalTID
)
NEOPktMsgCode
()
uint16
{
return
26
,
8
return
26
}
}
func
(
p
*
FinalTID
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
FinalTID
)
NEOPktEncodedLen
()
int
{
return
8
}
func
(
p
*
FinalTID
)
NEOPktEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
}
}
func
(
p
*
FinalTID
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
FinalTID
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -930,15 +1038,19 @@ overflow:
...
@@ -930,15 +1038,19 @@ overflow:
// 27. AnswerFinalTID
// 27. AnswerFinalTID
func
(
p
*
AnswerFinalTID
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerFinalTID
)
NEOPktMsgCode
()
uint16
{
return
27
,
8
return
27
}
func
(
p
*
AnswerFinalTID
)
NEOPktEncodedLen
()
int
{
return
8
}
}
func
(
p
*
AnswerFinalTID
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerFinalTID
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
func
(
p
*
AnswerFinalTID
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerFinalTID
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -951,16 +1063,20 @@ overflow:
...
@@ -951,16 +1063,20 @@ overflow:
// 28. ValidateTransaction
// 28. ValidateTransaction
func
(
p
*
ValidateTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
ValidateTransaction
)
NEOPktMsgCode
()
uint16
{
return
28
,
16
return
28
}
func
(
p
*
ValidateTransaction
)
NEOPktEncodedLen
()
int
{
return
16
}
}
func
(
p
*
ValidateTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ValidateTransaction
)
NEO
Pkt
Encode
(
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
))
}
}
func
(
p
*
ValidateTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ValidateTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
...
@@ -974,15 +1090,19 @@ overflow:
...
@@ -974,15 +1090,19 @@ overflow:
// 29. BeginTransaction
// 29. BeginTransaction
func
(
p
*
BeginTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
BeginTransaction
)
NEOPktMsgCode
()
uint16
{
return
29
,
8
return
29
}
}
func
(
p
*
BeginTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
BeginTransaction
)
NEOPktEncodedLen
()
int
{
return
8
}
func
(
p
*
BeginTransaction
)
NEOPktEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
func
(
p
*
BeginTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
BeginTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -995,15 +1115,19 @@ overflow:
...
@@ -995,15 +1115,19 @@ overflow:
// 30. AnswerBeginTransaction
// 30. AnswerBeginTransaction
func
(
p
*
AnswerBeginTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerBeginTransaction
)
NEOPktMsgCode
()
uint16
{
return
30
,
8
return
30
}
func
(
p
*
AnswerBeginTransaction
)
NEOPktEncodedLen
()
int
{
return
8
}
}
func
(
p
*
AnswerBeginTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerBeginTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
func
(
p
*
AnswerBeginTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerBeginTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -1016,11 +1140,15 @@ overflow:
...
@@ -1016,11 +1140,15 @@ overflow:
// 31. FailedVote
// 31. FailedVote
func
(
p
*
FailedVote
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
FailedVote
)
NEOPktMsgCode
()
uint16
{
return
31
,
12
+
len
(
p
.
NodeList
)
*
4
return
31
}
func
(
p
*
FailedVote
)
NEOPktEncodedLen
()
int
{
return
12
+
len
(
p
.
NodeList
)
*
4
}
}
func
(
p
*
FailedVote
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
FailedVote
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
l
:=
uint32
(
len
(
p
.
NodeList
))
...
@@ -1034,7 +1162,7 @@ func (p *FailedVote) NEOEncode(data []byte) {
...
@@ -1034,7 +1162,7 @@ func (p *FailedVote) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
FailedVote
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
FailedVote
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -1062,11 +1190,15 @@ overflow:
...
@@ -1062,11 +1190,15 @@ overflow:
// 32. FinishTransaction
// 32. FinishTransaction
func
(
p
*
FinishTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
FinishTransaction
)
NEOPktMsgCode
()
uint16
{
return
32
,
16
+
len
(
p
.
OIDList
)
*
8
+
len
(
p
.
CheckedList
)
*
8
return
32
}
}
func
(
p
*
FinishTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
FinishTransaction
)
NEOPktEncodedLen
()
int
{
return
16
+
len
(
p
.
OIDList
)
*
8
+
len
(
p
.
CheckedList
)
*
8
}
func
(
p
*
FinishTransaction
)
NEOPktEncode
(
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
))
...
@@ -1090,7 +1222,7 @@ func (p *FinishTransaction) NEOEncode(data []byte) {
...
@@ -1090,7 +1222,7 @@ func (p *FinishTransaction) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
FinishTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
FinishTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -1132,16 +1264,20 @@ overflow:
...
@@ -1132,16 +1264,20 @@ overflow:
// 33. AnswerFinishTransaction
// 33. AnswerFinishTransaction
func
(
p
*
AnswerFinishTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerFinishTransaction
)
NEOPktMsgCode
()
uint16
{
return
33
,
16
return
33
}
}
func
(
p
*
AnswerFinishTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerFinishTransaction
)
NEOPktEncodedLen
()
int
{
return
16
}
func
(
p
*
AnswerFinishTransaction
)
NEOPktEncode
(
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
))
}
}
func
(
p
*
AnswerFinishTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerFinishTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
...
@@ -1155,16 +1291,20 @@ overflow:
...
@@ -1155,16 +1291,20 @@ overflow:
// 34. NotifyTransactionFinished
// 34. NotifyTransactionFinished
func
(
p
*
NotifyTransactionFinished
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
NotifyTransactionFinished
)
NEOPktMsgCode
()
uint16
{
return
34
,
16
return
34
}
}
func
(
p
*
NotifyTransactionFinished
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyTransactionFinished
)
NEOPktEncodedLen
()
int
{
return
16
}
func
(
p
*
NotifyTransactionFinished
)
NEOPktEncode
(
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
))
}
}
func
(
p
*
NotifyTransactionFinished
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotifyTransactionFinished
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
...
@@ -1178,16 +1318,20 @@ overflow:
...
@@ -1178,16 +1318,20 @@ overflow:
// 35. LockInformation
// 35. LockInformation
func
(
p
*
LockInformation
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
LockInformation
)
NEOPktMsgCode
()
uint16
{
return
35
,
16
return
35
}
func
(
p
*
LockInformation
)
NEOPktEncodedLen
()
int
{
return
16
}
}
func
(
p
*
LockInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LockInformation
)
NEO
Pkt
Encode
(
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
))
}
}
func
(
p
*
LockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
LockInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
...
@@ -1201,15 +1345,19 @@ overflow:
...
@@ -1201,15 +1345,19 @@ overflow:
// 36. AnswerLockInformation
// 36. AnswerLockInformation
func
(
p
*
AnswerLockInformation
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerLockInformation
)
NEOPktMsgCode
()
uint16
{
return
36
,
8
return
36
}
}
func
(
p
*
AnswerLockInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLockInformation
)
NEOPktEncodedLen
()
int
{
return
8
}
func
(
p
*
AnswerLockInformation
)
NEOPktEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Ttid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Ttid
))
}
}
func
(
p
*
AnswerLockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLockInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -1222,11 +1370,15 @@ overflow:
...
@@ -1222,11 +1370,15 @@ overflow:
// 37. InvalidateObjects
// 37. InvalidateObjects
func
(
p
*
InvalidateObjects
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
InvalidateObjects
)
NEOPktMsgCode
()
uint16
{
return
37
,
12
+
len
(
p
.
OidList
)
*
8
return
37
}
}
func
(
p
*
InvalidateObjects
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
InvalidateObjects
)
NEOPktEncodedLen
()
int
{
return
12
+
len
(
p
.
OidList
)
*
8
}
func
(
p
*
InvalidateObjects
)
NEOPktEncode
(
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
))
...
@@ -1240,7 +1392,7 @@ func (p *InvalidateObjects) NEOEncode(data []byte) {
...
@@ -1240,7 +1392,7 @@ func (p *InvalidateObjects) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
InvalidateObjects
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
InvalidateObjects
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -1268,15 +1420,19 @@ overflow:
...
@@ -1268,15 +1420,19 @@ overflow:
// 38. UnlockInformation
// 38. UnlockInformation
func
(
p
*
UnlockInformation
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
UnlockInformation
)
NEOPktMsgCode
()
uint16
{
return
38
,
8
return
38
}
func
(
p
*
UnlockInformation
)
NEOPktEncodedLen
()
int
{
return
8
}
}
func
(
p
*
UnlockInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
UnlockInformation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
}
}
func
(
p
*
UnlockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
UnlockInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -1289,15 +1445,19 @@ overflow:
...
@@ -1289,15 +1445,19 @@ overflow:
// 39. GenerateOIDs
// 39. GenerateOIDs
func
(
p
*
GenerateOIDs
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
GenerateOIDs
)
NEOPktMsgCode
()
uint16
{
return
39
,
4
return
39
}
func
(
p
*
GenerateOIDs
)
NEOPktEncodedLen
()
int
{
return
4
}
}
func
(
p
*
GenerateOIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
GenerateOIDs
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
NumOIDs
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
NumOIDs
)
}
}
func
(
p
*
GenerateOIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
GenerateOIDs
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
}
}
...
@@ -1310,11 +1470,15 @@ overflow:
...
@@ -1310,11 +1470,15 @@ overflow:
// 40. AnswerGenerateOIDs
// 40. AnswerGenerateOIDs
func
(
p
*
AnswerGenerateOIDs
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerGenerateOIDs
)
NEOPktMsgCode
()
uint16
{
return
40
,
4
+
len
(
p
.
OidList
)
*
8
return
40
}
}
func
(
p
*
AnswerGenerateOIDs
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerGenerateOIDs
)
NEOPktEncodedLen
()
int
{
return
4
+
len
(
p
.
OidList
)
*
8
}
func
(
p
*
AnswerGenerateOIDs
)
NEOPktEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
OidList
))
l
:=
uint32
(
len
(
p
.
OidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -1327,7 +1491,7 @@ func (p *AnswerGenerateOIDs) NEOEncode(data []byte) {
...
@@ -1327,7 +1491,7 @@ func (p *AnswerGenerateOIDs) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerGenerateOIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerGenerateOIDs
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -1354,16 +1518,20 @@ overflow:
...
@@ -1354,16 +1518,20 @@ overflow:
// 41. Deadlock
// 41. Deadlock
func
(
p
*
Deadlock
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
Deadlock
)
NEOPktMsgCode
()
uint16
{
return
41
,
16
return
41
}
func
(
p
*
Deadlock
)
NEOPktEncodedLen
()
int
{
return
16
}
}
func
(
p
*
Deadlock
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Deadlock
)
NEO
Pkt
Encode
(
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
.
LockingTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
LockingTid
))
}
}
func
(
p
*
Deadlock
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Deadlock
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
...
@@ -1377,16 +1545,20 @@ overflow:
...
@@ -1377,16 +1545,20 @@ overflow:
// 42. RebaseTransaction
// 42. RebaseTransaction
func
(
p
*
RebaseTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
RebaseTransaction
)
NEOPktMsgCode
()
uint16
{
return
42
,
16
return
42
}
func
(
p
*
RebaseTransaction
)
NEOPktEncodedLen
()
int
{
return
16
}
}
func
(
p
*
RebaseTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RebaseTransaction
)
NEO
Pkt
Encode
(
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
.
LockingTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
LockingTid
))
}
}
func
(
p
*
RebaseTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RebaseTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
...
@@ -1400,11 +1572,15 @@ overflow:
...
@@ -1400,11 +1572,15 @@ overflow:
// 43. AnswerRebaseTransaction
// 43. AnswerRebaseTransaction
func
(
p
*
AnswerRebaseTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerRebaseTransaction
)
NEOPktMsgCode
()
uint16
{
return
43
,
4
+
len
(
p
.
OidList
)
*
8
return
43
}
}
func
(
p
*
AnswerRebaseTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerRebaseTransaction
)
NEOPktEncodedLen
()
int
{
return
4
+
len
(
p
.
OidList
)
*
8
}
func
(
p
*
AnswerRebaseTransaction
)
NEOPktEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
OidList
))
l
:=
uint32
(
len
(
p
.
OidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -1417,7 +1593,7 @@ func (p *AnswerRebaseTransaction) NEOEncode(data []byte) {
...
@@ -1417,7 +1593,7 @@ func (p *AnswerRebaseTransaction) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerRebaseTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerRebaseTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -1444,16 +1620,20 @@ overflow:
...
@@ -1444,16 +1620,20 @@ overflow:
// 44. RebaseObject
// 44. RebaseObject
func
(
p
*
RebaseObject
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
RebaseObject
)
NEOPktMsgCode
()
uint16
{
return
44
,
16
return
44
}
}
func
(
p
*
RebaseObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RebaseObject
)
NEOPktEncodedLen
()
int
{
return
16
}
func
(
p
*
RebaseObject
)
NEOPktEncode
(
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
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Oid
))
}
}
func
(
p
*
RebaseObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RebaseObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
...
@@ -1467,11 +1647,15 @@ overflow:
...
@@ -1467,11 +1647,15 @@ overflow:
// 45. AnswerRebaseObject
// 45. AnswerRebaseObject
func
(
p
*
AnswerRebaseObject
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerRebaseObject
)
NEOPktMsgCode
()
uint16
{
return
45
,
41
+
len
(
p
.
Data
)
return
45
}
func
(
p
*
AnswerRebaseObject
)
NEOPktEncodedLen
()
int
{
return
41
+
len
(
p
.
Data
)
}
}
func
(
p
*
AnswerRebaseObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerRebaseObject
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Serial
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Serial
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
ConflictSerial
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
ConflictSerial
))
(
data
[
16
:
])[
0
]
=
bool2byte
(
p
.
Compression
)
(
data
[
16
:
])[
0
]
=
bool2byte
(
p
.
Compression
)
...
@@ -1485,7 +1669,7 @@ func (p *AnswerRebaseObject) NEOEncode(data []byte) {
...
@@ -1485,7 +1669,7 @@ func (p *AnswerRebaseObject) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerRebaseObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerRebaseObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
41
{
if
uint32
(
len
(
data
))
<
41
{
goto
overflow
goto
overflow
...
@@ -1513,11 +1697,15 @@ overflow:
...
@@ -1513,11 +1697,15 @@ overflow:
// 46. StoreObject
// 46. StoreObject
func
(
p
*
StoreObject
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
StoreObject
)
NEOPktMsgCode
()
uint16
{
return
46
,
57
+
len
(
p
.
Data
)
return
46
}
func
(
p
*
StoreObject
)
NEOPktEncodedLen
()
int
{
return
57
+
len
(
p
.
Data
)
}
}
func
(
p
*
StoreObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StoreObject
)
NEO
Pkt
Encode
(
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
))
(
data
[
16
:
])[
0
]
=
bool2byte
(
p
.
Compression
)
(
data
[
16
:
])[
0
]
=
bool2byte
(
p
.
Compression
)
...
@@ -1533,7 +1721,7 @@ func (p *StoreObject) NEOEncode(data []byte) {
...
@@ -1533,7 +1721,7 @@ func (p *StoreObject) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
}
}
func
(
p
*
StoreObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
StoreObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
41
{
if
uint32
(
len
(
data
))
<
41
{
goto
overflow
goto
overflow
...
@@ -1563,15 +1751,19 @@ overflow:
...
@@ -1563,15 +1751,19 @@ overflow:
// 47. AnswerStoreObject
// 47. AnswerStoreObject
func
(
p
*
AnswerStoreObject
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerStoreObject
)
NEOPktMsgCode
()
uint16
{
return
47
,
8
return
47
}
}
func
(
p
*
AnswerStoreObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerStoreObject
)
NEOPktEncodedLen
()
int
{
return
8
}
func
(
p
*
AnswerStoreObject
)
NEOPktEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Conflict
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Conflict
))
}
}
func
(
p
*
AnswerStoreObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerStoreObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -1584,11 +1776,15 @@ overflow:
...
@@ -1584,11 +1776,15 @@ overflow:
// 48. AbortTransaction
// 48. AbortTransaction
func
(
p
*
AbortTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AbortTransaction
)
NEOPktMsgCode
()
uint16
{
return
48
,
12
+
len
(
p
.
NodeList
)
*
4
return
48
}
func
(
p
*
AbortTransaction
)
NEOPktEncodedLen
()
int
{
return
12
+
len
(
p
.
NodeList
)
*
4
}
}
func
(
p
*
AbortTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AbortTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
l
:=
uint32
(
len
(
p
.
NodeList
))
...
@@ -1602,7 +1798,7 @@ func (p *AbortTransaction) NEOEncode(data []byte) {
...
@@ -1602,7 +1798,7 @@ func (p *AbortTransaction) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AbortTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AbortTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -1630,11 +1826,15 @@ overflow:
...
@@ -1630,11 +1826,15 @@ overflow:
// 49. StoreTransaction
// 49. StoreTransaction
func
(
p
*
StoreTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
StoreTransaction
)
NEOPktMsgCode
()
uint16
{
return
49
,
24
+
len
(
p
.
User
)
+
len
(
p
.
Description
)
+
len
(
p
.
Extension
)
+
len
(
p
.
OidList
)
*
8
return
49
}
func
(
p
*
StoreTransaction
)
NEOPktEncodedLen
()
int
{
return
24
+
len
(
p
.
User
)
+
len
(
p
.
Description
)
+
len
(
p
.
Extension
)
+
len
(
p
.
OidList
)
*
8
}
}
func
(
p
*
StoreTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
StoreTransaction
)
NEO
Pkt
Encode
(
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
))
...
@@ -1669,7 +1869,7 @@ func (p *StoreTransaction) NEOEncode(data []byte) {
...
@@ -1669,7 +1869,7 @@ func (p *StoreTransaction) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
StoreTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
StoreTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -1727,15 +1927,19 @@ overflow:
...
@@ -1727,15 +1927,19 @@ overflow:
// 50. VoteTransaction
// 50. VoteTransaction
func
(
p
*
VoteTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
VoteTransaction
)
NEOPktMsgCode
()
uint16
{
return
50
,
8
return
50
}
}
func
(
p
*
VoteTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
VoteTransaction
)
NEOPktEncodedLen
()
int
{
return
8
}
func
(
p
*
VoteTransaction
)
NEOPktEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
func
(
p
*
VoteTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
VoteTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -1748,17 +1952,21 @@ overflow:
...
@@ -1748,17 +1952,21 @@ overflow:
// 51. GetObject
// 51. GetObject
func
(
p
*
GetObject
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
GetObject
)
NEOPktMsgCode
()
uint16
{
return
51
,
24
return
51
}
}
func
(
p
*
GetObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
GetObject
)
NEOPktEncodedLen
()
int
{
return
24
}
func
(
p
*
GetObject
)
NEOPktEncode
(
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
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
Tid
))
}
}
func
(
p
*
GetObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
GetObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
...
@@ -1773,11 +1981,15 @@ overflow:
...
@@ -1773,11 +1981,15 @@ overflow:
// 52. AnswerGetObject
// 52. AnswerGetObject
func
(
p
*
AnswerGetObject
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerGetObject
)
NEOPktMsgCode
()
uint16
{
return
52
,
57
+
len
(
p
.
Data
)
return
52
}
func
(
p
*
AnswerGetObject
)
NEOPktEncodedLen
()
int
{
return
57
+
len
(
p
.
Data
)
}
}
func
(
p
*
AnswerGetObject
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerGetObject
)
NEO
Pkt
Encode
(
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
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
NextSerial
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
NextSerial
))
...
@@ -1793,7 +2005,7 @@ func (p *AnswerGetObject) NEOEncode(data []byte) {
...
@@ -1793,7 +2005,7 @@ func (p *AnswerGetObject) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
DataSerial
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
DataSerial
))
}
}
func
(
p
*
AnswerGetObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerGetObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
49
{
if
uint32
(
len
(
data
))
<
49
{
goto
overflow
goto
overflow
...
@@ -1823,17 +2035,21 @@ overflow:
...
@@ -1823,17 +2035,21 @@ overflow:
// 53. TIDList
// 53. TIDList
func
(
p
*
TIDList
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
TIDList
)
NEOPktMsgCode
()
uint16
{
return
53
,
20
return
53
}
}
func
(
p
*
TIDList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TIDList
)
NEOPktEncodedLen
()
int
{
return
20
}
func
(
p
*
TIDList
)
NEOPktEncode
(
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
)
binary
.
BigEndian
.
PutUint32
(
data
[
16
:
],
p
.
Partition
)
binary
.
BigEndian
.
PutUint32
(
data
[
16
:
],
p
.
Partition
)
}
}
func
(
p
*
TIDList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TIDList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
20
{
if
uint32
(
len
(
data
))
<
20
{
goto
overflow
goto
overflow
}
}
...
@@ -1848,11 +2064,15 @@ overflow:
...
@@ -1848,11 +2064,15 @@ overflow:
// 54. AnswerTIDList
// 54. AnswerTIDList
func
(
p
*
AnswerTIDList
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerTIDList
)
NEOPktMsgCode
()
uint16
{
return
54
,
4
+
len
(
p
.
TIDList
)
*
8
return
54
}
}
func
(
p
*
AnswerTIDList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerTIDList
)
NEOPktEncodedLen
()
int
{
return
4
+
len
(
p
.
TIDList
)
*
8
}
func
(
p
*
AnswerTIDList
)
NEOPktEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
TIDList
))
l
:=
uint32
(
len
(
p
.
TIDList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -1865,7 +2085,7 @@ func (p *AnswerTIDList) NEOEncode(data []byte) {
...
@@ -1865,7 +2085,7 @@ func (p *AnswerTIDList) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerTIDList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerTIDList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -1892,18 +2112,22 @@ overflow:
...
@@ -1892,18 +2112,22 @@ overflow:
// 55. TIDListFrom
// 55. TIDListFrom
func
(
p
*
TIDListFrom
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
TIDListFrom
)
NEOPktMsgCode
()
uint16
{
return
55
,
24
return
55
}
func
(
p
*
TIDListFrom
)
NEOPktEncodedLen
()
int
{
return
24
}
}
func
(
p
*
TIDListFrom
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TIDListFrom
)
NEO
Pkt
Encode
(
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
))
binary
.
BigEndian
.
PutUint32
(
data
[
16
:
],
p
.
Length
)
binary
.
BigEndian
.
PutUint32
(
data
[
16
:
],
p
.
Length
)
binary
.
BigEndian
.
PutUint32
(
data
[
20
:
],
p
.
Partition
)
binary
.
BigEndian
.
PutUint32
(
data
[
20
:
],
p
.
Partition
)
}
}
func
(
p
*
TIDListFrom
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TIDListFrom
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
...
@@ -1919,11 +2143,15 @@ overflow:
...
@@ -1919,11 +2143,15 @@ overflow:
// 56. AnswerTIDListFrom
// 56. AnswerTIDListFrom
func
(
p
*
AnswerTIDListFrom
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerTIDListFrom
)
NEOPktMsgCode
()
uint16
{
return
56
,
4
+
len
(
p
.
TidList
)
*
8
return
56
}
func
(
p
*
AnswerTIDListFrom
)
NEOPktEncodedLen
()
int
{
return
4
+
len
(
p
.
TidList
)
*
8
}
}
func
(
p
*
AnswerTIDListFrom
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerTIDListFrom
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
TidList
))
l
:=
uint32
(
len
(
p
.
TidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -1936,7 +2164,7 @@ func (p *AnswerTIDListFrom) NEOEncode(data []byte) {
...
@@ -1936,7 +2164,7 @@ func (p *AnswerTIDListFrom) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerTIDListFrom
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerTIDListFrom
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -1963,15 +2191,19 @@ overflow:
...
@@ -1963,15 +2191,19 @@ overflow:
// 57. TransactionInformation
// 57. TransactionInformation
func
(
p
*
TransactionInformation
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
TransactionInformation
)
NEOPktMsgCode
()
uint16
{
return
57
,
8
return
57
}
}
func
(
p
*
TransactionInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TransactionInformation
)
NEOPktEncodedLen
()
int
{
return
8
}
func
(
p
*
TransactionInformation
)
NEOPktEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
func
(
p
*
TransactionInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TransactionInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -1984,11 +2216,15 @@ overflow:
...
@@ -1984,11 +2216,15 @@ overflow:
// 58. AnswerTransactionInformation
// 58. AnswerTransactionInformation
func
(
p
*
AnswerTransactionInformation
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerTransactionInformation
)
NEOPktMsgCode
()
uint16
{
return
58
,
25
+
len
(
p
.
User
)
+
len
(
p
.
Description
)
+
len
(
p
.
Extension
)
+
len
(
p
.
OidList
)
*
8
return
58
}
func
(
p
*
AnswerTransactionInformation
)
NEOPktEncodedLen
()
int
{
return
25
+
len
(
p
.
User
)
+
len
(
p
.
Description
)
+
len
(
p
.
Extension
)
+
len
(
p
.
OidList
)
*
8
}
}
func
(
p
*
AnswerTransactionInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerTransactionInformation
)
NEO
Pkt
Encode
(
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
))
...
@@ -2024,7 +2260,7 @@ func (p *AnswerTransactionInformation) NEOEncode(data []byte) {
...
@@ -2024,7 +2260,7 @@ func (p *AnswerTransactionInformation) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerTransactionInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerTransactionInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -2083,17 +2319,21 @@ overflow:
...
@@ -2083,17 +2319,21 @@ overflow:
// 59. ObjectHistory
// 59. ObjectHistory
func
(
p
*
ObjectHistory
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
ObjectHistory
)
NEOPktMsgCode
()
uint16
{
return
59
,
24
return
59
}
func
(
p
*
ObjectHistory
)
NEOPktEncodedLen
()
int
{
return
24
}
}
func
(
p
*
ObjectHistory
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ObjectHistory
)
NEO
Pkt
Encode
(
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
)
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
p
.
Last
)
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
p
.
Last
)
}
}
func
(
p
*
ObjectHistory
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ObjectHistory
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
...
@@ -2108,11 +2348,15 @@ overflow:
...
@@ -2108,11 +2348,15 @@ overflow:
// 60. AnswerObjectHistory
// 60. AnswerObjectHistory
func
(
p
*
AnswerObjectHistory
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerObjectHistory
)
NEOPktMsgCode
()
uint16
{
return
60
,
12
+
len
(
p
.
HistoryList
)
*
12
return
60
}
}
func
(
p
*
AnswerObjectHistory
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerObjectHistory
)
NEOPktEncodedLen
()
int
{
return
12
+
len
(
p
.
HistoryList
)
*
12
}
func
(
p
*
AnswerObjectHistory
)
NEOPktEncode
(
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
))
...
@@ -2127,7 +2371,7 @@ func (p *AnswerObjectHistory) NEOEncode(data []byte) {
...
@@ -2127,7 +2371,7 @@ func (p *AnswerObjectHistory) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerObjectHistory
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerObjectHistory
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -2159,17 +2403,21 @@ overflow:
...
@@ -2159,17 +2403,21 @@ overflow:
// 61. PartitionList
// 61. PartitionList
func
(
p
*
PartitionList
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
PartitionList
)
NEOPktMsgCode
()
uint16
{
return
61
,
12
return
61
}
func
(
p
*
PartitionList
)
NEOPktEncodedLen
()
int
{
return
12
}
}
func
(
p
*
PartitionList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PartitionList
)
NEO
Pkt
Encode
(
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
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
uint32
(
int32
(
p
.
NodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
uint32
(
int32
(
p
.
NodeUUID
)))
}
}
func
(
p
*
PartitionList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
PartitionList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
...
@@ -2184,16 +2432,20 @@ overflow:
...
@@ -2184,16 +2432,20 @@ overflow:
// 62. AnswerPartitionList
// 62. AnswerPartitionList
func
(
p
*
AnswerPartitionList
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerPartitionList
)
NEOPktMsgCode
()
uint16
{
return
62
}
func
(
p
*
AnswerPartitionList
)
NEOPktEncodedLen
()
int
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
size
+=
len
((
*
a
)
.
CellList
)
*
8
size
+=
len
((
*
a
)
.
CellList
)
*
8
}
}
return
62
,
12
+
len
(
p
.
RowList
)
*
8
+
size
return
12
+
len
(
p
.
RowList
)
*
8
+
size
}
}
func
(
p
*
AnswerPartitionList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPartitionList
)
NEO
Pkt
Encode
(
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
))
...
@@ -2218,7 +2470,7 @@ func (p *AnswerPartitionList) NEOEncode(data []byte) {
...
@@ -2218,7 +2470,7 @@ func (p *AnswerPartitionList) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerPartitionList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPartitionList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -2260,15 +2512,19 @@ overflow:
...
@@ -2260,15 +2512,19 @@ overflow:
// 63. NodeList
// 63. NodeList
func
(
p
*
NodeList
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
NodeList
)
NEOPktMsgCode
()
uint16
{
return
63
,
4
return
63
}
}
func
(
p
*
NodeList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NodeList
)
NEOPktEncodedLen
()
int
{
return
4
}
func
(
p
*
NodeList
)
NEOPktEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
}
}
func
(
p
*
NodeList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NodeList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
}
}
...
@@ -2281,16 +2537,20 @@ overflow:
...
@@ -2281,16 +2537,20 @@ overflow:
// 64. AnswerNodeList
// 64. AnswerNodeList
func
(
p
*
AnswerNodeList
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerNodeList
)
NEOPktMsgCode
()
uint16
{
return
64
}
func
(
p
*
AnswerNodeList
)
NEOPktEncodedLen
()
int
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
NodeList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
NodeList
);
i
++
{
a
:=
&
p
.
NodeList
[
i
]
a
:=
&
p
.
NodeList
[
i
]
size
+=
len
((
*
a
)
.
Address
.
Host
)
size
+=
len
((
*
a
)
.
Address
.
Host
)
}
}
return
64
,
4
+
len
(
p
.
NodeList
)
*
26
+
size
return
4
+
len
(
p
.
NodeList
)
*
26
+
size
}
}
func
(
p
*
AnswerNodeList
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerNodeList
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
l
:=
uint32
(
len
(
p
.
NodeList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -2314,7 +2574,7 @@ func (p *AnswerNodeList) NEOEncode(data []byte) {
...
@@ -2314,7 +2574,7 @@ func (p *AnswerNodeList) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerNodeList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerNodeList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -2355,16 +2615,20 @@ overflow:
...
@@ -2355,16 +2615,20 @@ overflow:
// 65. SetNodeState
// 65. SetNodeState
func
(
p
*
SetNodeState
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
SetNodeState
)
NEOPktMsgCode
()
uint16
{
return
65
,
8
return
65
}
func
(
p
*
SetNodeState
)
NEOPktEncodedLen
()
int
{
return
8
}
}
func
(
p
*
SetNodeState
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
SetNodeState
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
NodeState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
NodeState
)))
}
}
func
(
p
*
SetNodeState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
SetNodeState
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -2378,11 +2642,15 @@ overflow:
...
@@ -2378,11 +2642,15 @@ overflow:
// 66. AddPendingNodes
// 66. AddPendingNodes
func
(
p
*
AddPendingNodes
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AddPendingNodes
)
NEOPktMsgCode
()
uint16
{
return
66
,
4
+
len
(
p
.
NodeList
)
*
4
return
66
}
}
func
(
p
*
AddPendingNodes
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AddPendingNodes
)
NEOPktEncodedLen
()
int
{
return
4
+
len
(
p
.
NodeList
)
*
4
}
func
(
p
*
AddPendingNodes
)
NEOPktEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
l
:=
uint32
(
len
(
p
.
NodeList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -2395,7 +2663,7 @@ func (p *AddPendingNodes) NEOEncode(data []byte) {
...
@@ -2395,7 +2663,7 @@ func (p *AddPendingNodes) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AddPendingNodes
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AddPendingNodes
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -2422,11 +2690,15 @@ overflow:
...
@@ -2422,11 +2690,15 @@ overflow:
// 67. TweakPartitionTable
// 67. TweakPartitionTable
func
(
p
*
TweakPartitionTable
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
TweakPartitionTable
)
NEOPktMsgCode
()
uint16
{
return
67
,
4
+
len
(
p
.
NodeList
)
*
4
return
67
}
}
func
(
p
*
TweakPartitionTable
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
TweakPartitionTable
)
NEOPktEncodedLen
()
int
{
return
4
+
len
(
p
.
NodeList
)
*
4
}
func
(
p
*
TweakPartitionTable
)
NEOPktEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
l
:=
uint32
(
len
(
p
.
NodeList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -2439,7 +2711,7 @@ func (p *TweakPartitionTable) NEOEncode(data []byte) {
...
@@ -2439,7 +2711,7 @@ func (p *TweakPartitionTable) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
TweakPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TweakPartitionTable
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -2466,16 +2738,20 @@ overflow:
...
@@ -2466,16 +2738,20 @@ overflow:
// 68. NotifyNodeInformation
// 68. NotifyNodeInformation
func
(
p
*
NotifyNodeInformation
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
NotifyNodeInformation
)
NEOPktMsgCode
()
uint16
{
return
68
}
func
(
p
*
NotifyNodeInformation
)
NEOPktEncodedLen
()
int
{
var
size
int
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
NodeList
);
i
++
{
for
i
:=
0
;
i
<
len
(
p
.
NodeList
);
i
++
{
a
:=
&
p
.
NodeList
[
i
]
a
:=
&
p
.
NodeList
[
i
]
size
+=
len
((
*
a
)
.
Address
.
Host
)
size
+=
len
((
*
a
)
.
Address
.
Host
)
}
}
return
68
,
12
+
len
(
p
.
NodeList
)
*
26
+
size
return
12
+
len
(
p
.
NodeList
)
*
26
+
size
}
}
func
(
p
*
NotifyNodeInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyNodeInformation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
float64_NEOEncode
(
data
[
0
:
],
p
.
IdTimestamp
)
float64_NEOEncode
(
data
[
0
:
],
p
.
IdTimestamp
)
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
l
:=
uint32
(
len
(
p
.
NodeList
))
...
@@ -2500,7 +2776,7 @@ func (p *NotifyNodeInformation) NEOEncode(data []byte) {
...
@@ -2500,7 +2776,7 @@ func (p *NotifyNodeInformation) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
NotifyNodeInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotifyNodeInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
...
@@ -2542,28 +2818,36 @@ overflow:
...
@@ -2542,28 +2818,36 @@ overflow:
// 69. NodeInformation
// 69. NodeInformation
func
(
p
*
NodeInformation
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
NodeInformation
)
NEOPktMsgCode
()
uint16
{
return
69
,
0
return
69
}
func
(
p
*
NodeInformation
)
NEOPktEncodedLen
()
int
{
return
0
}
}
func
(
p
*
NodeInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NodeInformation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
}
}
func
(
p
*
NodeInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NodeInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
return
0
,
nil
}
}
// 70. SetClusterState
// 70. SetClusterState
func
(
p
*
SetClusterState
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
SetClusterState
)
NEOPktMsgCode
()
uint16
{
return
70
,
4
return
70
}
}
func
(
p
*
SetClusterState
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
SetClusterState
)
NEOPktEncodedLen
()
int
{
return
4
}
func
(
p
*
SetClusterState
)
NEOPktEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
}
}
func
(
p
*
SetClusterState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
SetClusterState
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
}
}
...
@@ -2576,15 +2860,19 @@ overflow:
...
@@ -2576,15 +2860,19 @@ overflow:
// 71. repairFlags
// 71. repairFlags
func
(
p
*
repairFlags
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
repairFlags
)
NEOPktMsgCode
()
uint16
{
return
71
,
1
return
71
}
func
(
p
*
repairFlags
)
NEOPktEncodedLen
()
int
{
return
1
}
}
func
(
p
*
repairFlags
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
repairFlags
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
DryRun
)
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
DryRun
)
}
}
func
(
p
*
repairFlags
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
repairFlags
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
1
{
if
uint32
(
len
(
data
))
<
1
{
goto
overflow
goto
overflow
}
}
...
@@ -2597,11 +2885,15 @@ overflow:
...
@@ -2597,11 +2885,15 @@ overflow:
// 72. Repair
// 72. Repair
func
(
p
*
Repair
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
Repair
)
NEOPktMsgCode
()
uint16
{
return
72
,
5
+
len
(
p
.
NodeList
)
*
4
return
72
}
func
(
p
*
Repair
)
NEOPktEncodedLen
()
int
{
return
5
+
len
(
p
.
NodeList
)
*
4
}
}
func
(
p
*
Repair
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Repair
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
l
:=
uint32
(
len
(
p
.
NodeList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -2615,7 +2907,7 @@ func (p *Repair) NEOEncode(data []byte) {
...
@@ -2615,7 +2907,7 @@ func (p *Repair) NEOEncode(data []byte) {
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
repairFlags
.
DryRun
)
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
repairFlags
.
DryRun
)
}
}
func
(
p
*
Repair
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Repair
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -2643,15 +2935,19 @@ overflow:
...
@@ -2643,15 +2935,19 @@ overflow:
// 73. RepairOne
// 73. RepairOne
func
(
p
*
RepairOne
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
RepairOne
)
NEOPktMsgCode
()
uint16
{
return
73
,
1
return
73
}
}
func
(
p
*
RepairOne
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
RepairOne
)
NEOPktEncodedLen
()
int
{
return
1
}
func
(
p
*
RepairOne
)
NEOPktEncode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
repairFlags
.
DryRun
)
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
repairFlags
.
DryRun
)
}
}
func
(
p
*
RepairOne
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RepairOne
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
1
{
if
uint32
(
len
(
data
))
<
1
{
goto
overflow
goto
overflow
}
}
...
@@ -2664,15 +2960,19 @@ overflow:
...
@@ -2664,15 +2960,19 @@ overflow:
// 74. ClusterInformation
// 74. ClusterInformation
func
(
p
*
ClusterInformation
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
ClusterInformation
)
NEOPktMsgCode
()
uint16
{
return
74
,
4
return
74
}
}
func
(
p
*
ClusterInformation
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ClusterInformation
)
NEOPktEncodedLen
()
int
{
return
4
}
func
(
p
*
ClusterInformation
)
NEOPktEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
}
}
func
(
p
*
ClusterInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ClusterInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
}
}
...
@@ -2685,15 +2985,19 @@ overflow:
...
@@ -2685,15 +2985,19 @@ overflow:
// 75. X_ClusterState
// 75. X_ClusterState
func
(
p
*
X_ClusterState
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
X_ClusterState
)
NEOPktMsgCode
()
uint16
{
return
75
,
4
return
75
}
func
(
p
*
X_ClusterState
)
NEOPktEncodedLen
()
int
{
return
4
}
}
func
(
p
*
X_ClusterState
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
X_ClusterState
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
}
}
func
(
p
*
X_ClusterState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
X_ClusterState
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
}
}
...
@@ -2706,11 +3010,15 @@ overflow:
...
@@ -2706,11 +3010,15 @@ overflow:
// 76. ObjectUndoSerial
// 76. ObjectUndoSerial
func
(
p
*
ObjectUndoSerial
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
ObjectUndoSerial
)
NEOPktMsgCode
()
uint16
{
return
76
,
28
+
len
(
p
.
OidList
)
*
8
return
76
}
}
func
(
p
*
ObjectUndoSerial
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
ObjectUndoSerial
)
NEOPktEncodedLen
()
int
{
return
28
+
len
(
p
.
OidList
)
*
8
}
func
(
p
*
ObjectUndoSerial
)
NEOPktEncode
(
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
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
UndoneTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
UndoneTID
))
...
@@ -2726,7 +3034,7 @@ func (p *ObjectUndoSerial) NEOEncode(data []byte) {
...
@@ -2726,7 +3034,7 @@ func (p *ObjectUndoSerial) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
ObjectUndoSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ObjectUndoSerial
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
28
{
if
uint32
(
len
(
data
))
<
28
{
goto
overflow
goto
overflow
...
@@ -2756,11 +3064,15 @@ overflow:
...
@@ -2756,11 +3064,15 @@ overflow:
// 77. AnswerObjectUndoSerial
// 77. AnswerObjectUndoSerial
func
(
p
*
AnswerObjectUndoSerial
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerObjectUndoSerial
)
NEOPktMsgCode
()
uint16
{
return
77
,
4
+
len
(
p
.
ObjectTIDDict
)
*
25
return
77
}
}
func
(
p
*
AnswerObjectUndoSerial
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerObjectUndoSerial
)
NEOPktEncodedLen
()
int
{
return
4
+
len
(
p
.
ObjectTIDDict
)
*
25
}
func
(
p
*
AnswerObjectUndoSerial
)
NEOPktEncode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
ObjectTIDDict
))
l
:=
uint32
(
len
(
p
.
ObjectTIDDict
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -2780,7 +3092,7 @@ func (p *AnswerObjectUndoSerial) NEOEncode(data []byte) {
...
@@ -2780,7 +3092,7 @@ func (p *AnswerObjectUndoSerial) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
AnswerObjectUndoSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerObjectUndoSerial
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -2820,17 +3132,21 @@ overflow:
...
@@ -2820,17 +3132,21 @@ overflow:
// 78. CheckCurrentSerial
// 78. CheckCurrentSerial
func
(
p
*
CheckCurrentSerial
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
CheckCurrentSerial
)
NEOPktMsgCode
()
uint16
{
return
78
,
24
return
78
}
func
(
p
*
CheckCurrentSerial
)
NEOPktEncodedLen
()
int
{
return
24
}
}
func
(
p
*
CheckCurrentSerial
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckCurrentSerial
)
NEO
Pkt
Encode
(
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
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
Serial
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
Serial
))
}
}
func
(
p
*
CheckCurrentSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckCurrentSerial
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
...
@@ -2845,15 +3161,19 @@ overflow:
...
@@ -2845,15 +3161,19 @@ overflow:
// 79. Pack
// 79. Pack
func
(
p
*
Pack
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
Pack
)
NEOPktMsgCode
()
uint16
{
return
79
,
8
return
79
}
func
(
p
*
Pack
)
NEOPktEncodedLen
()
int
{
return
8
}
}
func
(
p
*
Pack
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
Pack
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
func
(
p
*
Pack
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Pack
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -2866,15 +3186,19 @@ overflow:
...
@@ -2866,15 +3186,19 @@ overflow:
// 80. AnswerPack
// 80. AnswerPack
func
(
p
*
AnswerPack
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerPack
)
NEOPktMsgCode
()
uint16
{
return
80
,
1
return
80
}
}
func
(
p
*
AnswerPack
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerPack
)
NEOPktEncodedLen
()
int
{
return
1
}
func
(
p
*
AnswerPack
)
NEOPktEncode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Status
)
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Status
)
}
}
func
(
p
*
AnswerPack
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPack
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
1
{
if
uint32
(
len
(
data
))
<
1
{
goto
overflow
goto
overflow
}
}
...
@@ -2887,11 +3211,15 @@ overflow:
...
@@ -2887,11 +3211,15 @@ overflow:
// 81. CheckReplicas
// 81. CheckReplicas
func
(
p
*
CheckReplicas
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
CheckReplicas
)
NEOPktMsgCode
()
uint16
{
return
81
,
20
+
len
(
p
.
PartitionDict
)
*
8
return
81
}
func
(
p
*
CheckReplicas
)
NEOPktEncodedLen
()
int
{
return
20
+
len
(
p
.
PartitionDict
)
*
8
}
}
func
(
p
*
CheckReplicas
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckReplicas
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
{
{
l
:=
uint32
(
len
(
p
.
PartitionDict
))
l
:=
uint32
(
len
(
p
.
PartitionDict
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
@@ -2911,7 +3239,7 @@ func (p *CheckReplicas) NEOEncode(data []byte) {
...
@@ -2911,7 +3239,7 @@ func (p *CheckReplicas) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
}
}
func
(
p
*
CheckReplicas
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckReplicas
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
goto
overflow
...
@@ -2941,11 +3269,15 @@ overflow:
...
@@ -2941,11 +3269,15 @@ overflow:
// 82. CheckPartition
// 82. CheckPartition
func
(
p
*
CheckPartition
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
CheckPartition
)
NEOPktMsgCode
()
uint16
{
return
82
,
30
+
len
(
p
.
Source
.
UpstreamName
)
+
len
(
p
.
Source
.
Address
.
Host
)
return
82
}
func
(
p
*
CheckPartition
)
NEOPktEncodedLen
()
int
{
return
30
+
len
(
p
.
Source
.
UpstreamName
)
+
len
(
p
.
Source
.
Address
.
Host
)
}
}
func
(
p
*
CheckPartition
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckPartition
)
NEO
Pkt
Encode
(
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
))
...
@@ -2966,7 +3298,7 @@ func (p *CheckPartition) NEOEncode(data []byte) {
...
@@ -2966,7 +3298,7 @@ func (p *CheckPartition) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
10
:
],
uint64
(
p
.
MaxTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
10
:
],
uint64
(
p
.
MaxTID
))
}
}
func
(
p
*
CheckPartition
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckPartition
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
...
@@ -3003,18 +3335,22 @@ overflow:
...
@@ -3003,18 +3335,22 @@ overflow:
// 83. CheckTIDRange
// 83. CheckTIDRange
func
(
p
*
CheckTIDRange
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
CheckTIDRange
)
NEOPktMsgCode
()
uint16
{
return
83
,
24
return
83
}
}
func
(
p
*
CheckTIDRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckTIDRange
)
NEOPktEncodedLen
()
int
{
return
24
}
func
(
p
*
CheckTIDRange
)
NEOPktEncode
(
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
)
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
MaxTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
MaxTID
))
}
}
func
(
p
*
CheckTIDRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckTIDRange
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
...
@@ -3030,17 +3366,21 @@ overflow:
...
@@ -3030,17 +3366,21 @@ overflow:
// 84. AnswerCheckTIDRange
// 84. AnswerCheckTIDRange
func
(
p
*
AnswerCheckTIDRange
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerCheckTIDRange
)
NEOPktMsgCode
()
uint16
{
return
84
,
32
return
84
}
}
func
(
p
*
AnswerCheckTIDRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerCheckTIDRange
)
NEOPktEncodedLen
()
int
{
return
32
}
func
(
p
*
AnswerCheckTIDRange
)
NEOPktEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Count
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Count
)
copy
(
data
[
4
:
],
p
.
Checksum
[
:
])
copy
(
data
[
4
:
],
p
.
Checksum
[
:
])
binary
.
BigEndian
.
PutUint64
(
data
[
24
:
],
uint64
(
p
.
MaxTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
24
:
],
uint64
(
p
.
MaxTID
))
}
}
func
(
p
*
AnswerCheckTIDRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerCheckTIDRange
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
32
{
if
uint32
(
len
(
data
))
<
32
{
goto
overflow
goto
overflow
}
}
...
@@ -3055,11 +3395,15 @@ overflow:
...
@@ -3055,11 +3395,15 @@ overflow:
// 85. CheckSerialRange
// 85. CheckSerialRange
func
(
p
*
CheckSerialRange
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
CheckSerialRange
)
NEOPktMsgCode
()
uint16
{
return
85
,
32
return
85
}
func
(
p
*
CheckSerialRange
)
NEOPktEncodedLen
()
int
{
return
32
}
}
func
(
p
*
CheckSerialRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
CheckSerialRange
)
NEO
Pkt
Encode
(
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
)
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MinTID
))
...
@@ -3067,7 +3411,7 @@ func (p *CheckSerialRange) NEOEncode(data []byte) {
...
@@ -3067,7 +3411,7 @@ func (p *CheckSerialRange) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
24
:
],
uint64
(
p
.
MinOID
))
binary
.
BigEndian
.
PutUint64
(
data
[
24
:
],
uint64
(
p
.
MinOID
))
}
}
func
(
p
*
CheckSerialRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckSerialRange
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
32
{
if
uint32
(
len
(
data
))
<
32
{
goto
overflow
goto
overflow
}
}
...
@@ -3084,11 +3428,15 @@ overflow:
...
@@ -3084,11 +3428,15 @@ overflow:
// 86. AnswerCheckSerialRange
// 86. AnswerCheckSerialRange
func
(
p
*
AnswerCheckSerialRange
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerCheckSerialRange
)
NEOPktMsgCode
()
uint16
{
return
86
,
60
return
86
}
func
(
p
*
AnswerCheckSerialRange
)
NEOPktEncodedLen
()
int
{
return
60
}
}
func
(
p
*
AnswerCheckSerialRange
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerCheckSerialRange
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Count
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Count
)
copy
(
data
[
4
:
],
p
.
TidChecksum
[
:
])
copy
(
data
[
4
:
],
p
.
TidChecksum
[
:
])
binary
.
BigEndian
.
PutUint64
(
data
[
24
:
],
uint64
(
p
.
MaxTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
24
:
],
uint64
(
p
.
MaxTID
))
...
@@ -3096,7 +3444,7 @@ func (p *AnswerCheckSerialRange) NEOEncode(data []byte) {
...
@@ -3096,7 +3444,7 @@ func (p *AnswerCheckSerialRange) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
52
:
],
uint64
(
p
.
MaxOID
))
binary
.
BigEndian
.
PutUint64
(
data
[
52
:
],
uint64
(
p
.
MaxOID
))
}
}
func
(
p
*
AnswerCheckSerialRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerCheckSerialRange
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
60
{
if
uint32
(
len
(
data
))
<
60
{
goto
overflow
goto
overflow
}
}
...
@@ -3113,11 +3461,15 @@ overflow:
...
@@ -3113,11 +3461,15 @@ overflow:
// 87. PartitionCorrupted
// 87. PartitionCorrupted
func
(
p
*
PartitionCorrupted
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
PartitionCorrupted
)
NEOPktMsgCode
()
uint16
{
return
87
,
8
+
len
(
p
.
CellList
)
*
4
return
87
}
}
func
(
p
*
PartitionCorrupted
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
PartitionCorrupted
)
NEOPktEncodedLen
()
int
{
return
8
+
len
(
p
.
CellList
)
*
4
}
func
(
p
*
PartitionCorrupted
)
NEOPktEncode
(
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
))
...
@@ -3131,7 +3483,7 @@ func (p *PartitionCorrupted) NEOEncode(data []byte) {
...
@@ -3131,7 +3483,7 @@ func (p *PartitionCorrupted) NEOEncode(data []byte) {
}
}
}
}
func
(
p
*
PartitionCorrupted
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
PartitionCorrupted
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
...
@@ -3159,28 +3511,36 @@ overflow:
...
@@ -3159,28 +3511,36 @@ overflow:
// 88. LastTransaction
// 88. LastTransaction
func
(
p
*
LastTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
LastTransaction
)
NEOPktMsgCode
()
uint16
{
return
88
,
0
return
88
}
}
func
(
p
*
LastTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
LastTransaction
)
NEOPktEncodedLen
()
int
{
return
0
}
}
func
(
p
*
LastTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
LastTransaction
)
NEOPktEncode
(
data
[]
byte
)
{
}
func
(
p
*
LastTransaction
)
NEOPktDecode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
return
0
,
nil
}
}
// 89. AnswerLastTransaction
// 89. AnswerLastTransaction
func
(
p
*
AnswerLastTransaction
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
AnswerLastTransaction
)
NEOPktMsgCode
()
uint16
{
return
89
,
8
return
89
}
func
(
p
*
AnswerLastTransaction
)
NEOPktEncodedLen
()
int
{
return
8
}
}
func
(
p
*
AnswerLastTransaction
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
AnswerLastTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
}
func
(
p
*
AnswerLastTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLastTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
...
@@ -3193,14 +3553,18 @@ overflow:
...
@@ -3193,14 +3553,18 @@ overflow:
// 90. NotifyReady
// 90. NotifyReady
func
(
p
*
NotifyReady
)
NEOEncodedInfo
()
(
uint16
,
int
)
{
func
(
_
*
NotifyReady
)
NEOPktMsgCode
()
uint16
{
return
90
,
0
return
90
}
func
(
p
*
NotifyReady
)
NEOPktEncodedLen
()
int
{
return
0
}
}
func
(
p
*
NotifyReady
)
NEOEncode
(
data
[]
byte
)
{
func
(
p
*
NotifyReady
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
}
}
func
(
p
*
NotifyReady
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotifyReady
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
return
0
,
nil
}
}
...
...
go/neo/proto.go
View file @
65ff3185
...
@@ -137,29 +137,42 @@ type NodeUUID int32
...
@@ -137,29 +137,42 @@ type NodeUUID int32
var
ErrDecodeOverflow
=
errors
.
New
(
"decode: bufer overflow"
)
var
ErrDecodeOverflow
=
errors
.
New
(
"decode: bufer overflow"
)
// NEOEncoder is interface for marshaling packets to wire format
// NEOPkt is the interface implemented by packets to marshal/unmarshal them into/from wire format
type
NEOEncoder
interface
{
type
NEOPkt
interface
{
// NEOEncodedInfo returns message code needed to be used for the packet
// NEOPktMsgCode returns message code needed to be used for particular packet type
// on the wire and how much space is needed to encode payload
// on the wire
// XXX naming?
NEOPktMsgCode
()
uint16
NEOEncodedInfo
()
(
msgCode
uint16
,
payloadLen
int
)
// NEOEncode performs the encoding.
// NEOPktEncodedLen returns how much space is needed to encode current state
// len(buf) must be >= payloadLen returned by NEOEncodedInfo
NEOPktEncodedLen
()
int
NEOEncode
(
buf
[]
byte
)
// NEOPktEncode encodes current state into buf.
// len(buf) must be >= NEOPktEncodedLen()
NEOPktEncode
(
buf
[]
byte
)
// NEOPktDecode decodes data into.
NEOPktDecode
(
data
[]
byte
)
(
nread
int
,
err
error
)
}
}
// NEODecoder is interface for unmarshalling packets from wire format
/*
type
NEODecoder
interface
{
// XXX do we need to keep it splitted as encoder/decoder ?
NEODecode
(
data
[]
byte
)
(
nread
int
,
err
error
)
// NEOPktDecoder is the interface implemented by packets to unmarshal them from wire format
type NEOPktDecoder interface {
// NEOPktMsgCode returns message code that must have been used on the wire for this packet
NEOPktMsgCode() uint16
}
}
// NEO
Codec is interface combining NEOEncoder & NEO
Decoder
// NEO
Pkt is interface combining NEOPktEncoder & NEOPkt
Decoder
// in particular it covers all NEO packets
// in particular it covers all NEO packets
type
NEOCodec
interface
{
type NEOPkt interface {
NEOEncoder
NEOPktEncoder
NEODecoder
NEOPktDecoder
// XXX is in both encoder and decoder
NEOPktMsgCode() uint16
}
}
*/
type
Address
struct
{
type
Address
struct
{
Host
string
Host
string
...
@@ -167,7 +180,7 @@ type Address struct {
...
@@ -167,7 +180,7 @@ type Address struct {
}
}
// NOTE if Host == "" -> Port not added to wire (see py.PAddress):
// NOTE if Host == "" -> Port not added to wire (see py.PAddress):
// func (a *Address) NEOEncode(b []byte) int {
// func (a *Address) NEO
Pkt
Encode(b []byte) int {
// n := string_NEOEncode(a.Host, b[0:])
// n := string_NEOEncode(a.Host, b[0:])
// if a.Host != "" {
// if a.Host != "" {
// BigEndian.PutUint16(b[n:], a.Port)
// BigEndian.PutUint16(b[n:], a.Port)
...
...
go/neo/proto_test.go
View file @
65ff3185
...
@@ -69,9 +69,9 @@ func TestPktHeader(t *testing.T) {
...
@@ -69,9 +69,9 @@ func TestPktHeader(t *testing.T) {
}
}
// test marshalling for one packet type
// test marshalling for one packet type
func
testPktMarshal
(
t
*
testing
.
T
,
pkt
NEO
Codec
,
encoded
string
)
{
func
testPktMarshal
(
t
*
testing
.
T
,
pkt
NEO
Pkt
,
encoded
string
)
{
typ
:=
reflect
.
TypeOf
(
pkt
)
.
Elem
()
// type of *pkt
typ
:=
reflect
.
TypeOf
(
pkt
)
.
Elem
()
// type of *pkt
pkt2
:=
reflect
.
New
(
typ
)
.
Interface
()
.
(
NEO
Codec
)
pkt2
:=
reflect
.
New
(
typ
)
.
Interface
()
.
(
NEO
Pkt
)
defer
func
()
{
defer
func
()
{
if
e
:=
recover
();
e
!=
nil
{
if
e
:=
recover
();
e
!=
nil
{
t
.
Errorf
(
"%v: panic ↓↓↓:"
,
typ
)
t
.
Errorf
(
"%v: panic ↓↓↓:"
,
typ
)
...
@@ -80,7 +80,8 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
...
@@ -80,7 +80,8 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
}()
}()
// pkt.encode() == expected
// pkt.encode() == expected
msgCode
,
n
:=
pkt
.
NEOEncodedInfo
()
msgCode
:=
pkt
.
NEOPktMsgCode
()
n
:=
pkt
.
NEOPktEncodedLen
()
msgType
:=
pktTypeRegistry
[
msgCode
]
msgType
:=
pktTypeRegistry
[
msgCode
]
if
msgType
!=
typ
{
if
msgType
!=
typ
{
t
.
Errorf
(
"%v: msgCode = %v which corresponds to %v"
,
typ
,
msgCode
,
msgType
)
t
.
Errorf
(
"%v: msgCode = %v which corresponds to %v"
,
typ
,
msgCode
,
msgType
)
...
@@ -90,7 +91,7 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
...
@@ -90,7 +91,7 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
}
}
buf
:=
make
([]
byte
,
n
)
buf
:=
make
([]
byte
,
n
)
pkt
.
NEOEncode
(
buf
)
pkt
.
NEO
Pkt
Encode
(
buf
)
if
string
(
buf
)
!=
encoded
{
if
string
(
buf
)
!=
encoded
{
t
.
Errorf
(
"%v: encode result unexpected:"
,
typ
)
t
.
Errorf
(
"%v: encode result unexpected:"
,
typ
)
t
.
Errorf
(
"
\t
have: %s"
,
hexpkg
.
EncodeToString
(
buf
))
t
.
Errorf
(
"
\t
have: %s"
,
hexpkg
.
EncodeToString
(
buf
))
...
@@ -120,13 +121,13 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
...
@@ -120,13 +121,13 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
}
}
}()
}()
pkt
.
NEOEncode
(
buf
[
:
l
])
pkt
.
NEO
Pkt
Encode
(
buf
[
:
l
])
}()
}()
}
}
// pkt.decode() == expected
// pkt.decode() == expected
data
:=
[]
byte
(
encoded
+
"noise"
)
data
:=
[]
byte
(
encoded
+
"noise"
)
n
,
err
:=
pkt2
.
NEODecode
(
data
)
n
,
err
:=
pkt2
.
NEO
Pkt
Decode
(
data
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"%v: decode error %v"
,
typ
,
err
)
t
.
Errorf
(
"%v: decode error %v"
,
typ
,
err
)
}
}
...
@@ -140,7 +141,7 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
...
@@ -140,7 +141,7 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
// decode must detect buffer overflow
// decode must detect buffer overflow
for
l
:=
len
(
encoded
)
-
1
;
l
>=
0
;
l
--
{
for
l
:=
len
(
encoded
)
-
1
;
l
>=
0
;
l
--
{
n
,
err
=
pkt2
.
NEODecode
(
data
[
:
l
])
n
,
err
=
pkt2
.
NEO
Pkt
Decode
(
data
[
:
l
])
if
!
(
n
==
0
&&
err
==
ErrDecodeOverflow
)
{
if
!
(
n
==
0
&&
err
==
ErrDecodeOverflow
)
{
t
.
Errorf
(
"%v: decode overflow not detected on [:%v]"
,
typ
,
l
)
t
.
Errorf
(
"%v: decode overflow not detected on [:%v]"
,
typ
,
l
)
}
}
...
@@ -151,7 +152,7 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
...
@@ -151,7 +152,7 @@ func testPktMarshal(t *testing.T, pkt NEOCodec, encoded string) {
// test encoding/decoding of packets
// test encoding/decoding of packets
func
TestPktMarshal
(
t
*
testing
.
T
)
{
func
TestPktMarshal
(
t
*
testing
.
T
)
{
var
testv
=
[]
struct
{
var
testv
=
[]
struct
{
pkt
NEO
Codec
pkt
NEO
Pkt
encoded
string
// []byte
encoded
string
// []byte
}
{
}
{
// empty
// empty
...
@@ -267,12 +268,12 @@ func TestPktMarshal(t *testing.T) {
...
@@ -267,12 +268,12 @@ func TestPktMarshal(t *testing.T) {
func
TestPktMarshalAllOverflowLightly
(
t
*
testing
.
T
)
{
func
TestPktMarshalAllOverflowLightly
(
t
*
testing
.
T
)
{
for
_
,
typ
:=
range
pktTypeRegistry
{
for
_
,
typ
:=
range
pktTypeRegistry
{
// zero-value for a type
// zero-value for a type
pkt
:=
reflect
.
New
(
typ
)
.
Interface
()
.
(
NEO
Codec
)
pkt
:=
reflect
.
New
(
typ
)
.
Interface
()
.
(
NEO
Pkt
)
_
,
l
:=
pkt
.
NEOEncodedInfo
()
l
:=
pkt
.
NEOPktEncodedLen
()
zerol
:=
make
([]
byte
,
l
)
zerol
:=
make
([]
byte
,
l
)
// decoding will turn nil slice & map into empty allocated ones.
// decoding will turn nil slice & map into empty allocated ones.
// we need it so that reflect.DeepEqual works for pkt encode/decode comparison
// we need it so that reflect.DeepEqual works for pkt encode/decode comparison
n
,
err
:=
pkt
.
NEODecode
(
zerol
)
n
,
err
:=
pkt
.
NEO
Pkt
Decode
(
zerol
)
if
!
(
n
==
l
&&
err
==
nil
)
{
if
!
(
n
==
l
&&
err
==
nil
)
{
t
.
Errorf
(
"%v: zero-decode unexpected: %v, %v ; want %v, nil"
,
typ
,
n
,
err
,
l
)
t
.
Errorf
(
"%v: zero-decode unexpected: %v, %v ; want %v, nil"
,
typ
,
n
,
err
,
l
)
}
}
...
...
go/neo/protogen.go
View file @
65ff3185
...
@@ -21,12 +21,12 @@
...
@@ -21,12 +21,12 @@
NEO. Protocol module. Code generator
NEO. Protocol module. Code generator
This program generates marshalling code for packet types defined in proto.go .
This program generates marshalling code for packet types defined in proto.go .
For every type 3 methods are generated in accordance with NEOEncoder and
For every type 4 methods are generated in accordance with NEOPkt interface:
NEODecoder interfaces:
NEOEncodedInfo() (msgCode uint16, payloadLen int)
NEOPktMsgCode() uint16
NEOEncode(buf []byte)
NEOPktEncodedLen() int
NEODecode(data []byte) (nread int, err error)
NEOPktEncode(buf []byte)
NEOPktDecode(data []byte) (nread int, err error)
List of packet types is obtained via searching through proto.go AST - looking
List of packet types is obtained via searching through proto.go AST - looking
for appropriate struct declarations there.
for appropriate struct declarations there.
...
@@ -197,7 +197,11 @@ import (
...
@@ -197,7 +197,11 @@ import (
case
*
ast
.
StructType
:
case
*
ast
.
StructType
:
fmt
.
Fprintf
(
&
buf
,
"// %d. %s
\n\n
"
,
pktCode
,
typename
)
fmt
.
Fprintf
(
&
buf
,
"// %d. %s
\n\n
"
,
pktCode
,
typename
)
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
sizer
{
msgCode
:
pktCode
}))
buf
.
emit
(
"func (_ *%s) NEOPktMsgCode() uint16 {"
,
typename
)
buf
.
emit
(
"return %d"
,
pktCode
)
buf
.
emit
(
"}
\n
"
)
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
sizer
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
encoder
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
encoder
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
decoder
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
decoder
{}))
...
@@ -460,17 +464,13 @@ func (o *OverflowCheck) AddExpr(format string, a ...interface{}) {
...
@@ -460,17 +464,13 @@ func (o *OverflowCheck) AddExpr(format string, a ...interface{}) {
type
sizer
struct
{
type
sizer
struct
{
commonCodeGen
commonCodeGen
size
SymSize
// currently accumulated packet size
size
SymSize
// currently accumulated packet size
// which code to also return as packet msgCode
// (sizer does not compute this - it is emitted as-is given by caller)
msgCode
int
}
}
// encoder generates code to encode a packet
// encoder generates code to encode a packet
//
//
// when type is recursively walked, for every case code to update `data[n:]` is generated.
// when type is recursively walked, for every case code to update `data[n:]` is generated.
// no overflow checks are generated as by NEO
Encoder
interface provided data
// no overflow checks are generated as by NEO
Pkt
interface provided data
// buffer should have at least payloadLen length returned by NEOEncodedInfo()
// buffer should have at least payloadLen length returned by NEO
Pkt
EncodedInfo()
// (the size computed by sizer).
// (the size computed by sizer).
//
//
// the code emitted looks like:
// the code emitted looks like:
...
@@ -479,7 +479,7 @@ type sizer struct {
...
@@ -479,7 +479,7 @@ type sizer struct {
// encode<typ2>(data[n2:], path2)
// encode<typ2>(data[n2:], path2)
// ...
// ...
//
//
// TODO encode have to care in NEOEncode to emit preambule such that bound
// TODO encode have to care in NEO
Pkt
Encode to emit preambule such that bound
// checking is performed only once (currenty compiler emits many of them)
// checking is performed only once (currenty compiler emits many of them)
type
encoder
struct
{
type
encoder
struct
{
commonCodeGen
commonCodeGen
...
@@ -527,7 +527,7 @@ var _ CodeGenerator = (*decoder)(nil)
...
@@ -527,7 +527,7 @@ var _ CodeGenerator = (*decoder)(nil)
func
(
s
*
sizer
)
generatedCode
()
string
{
func
(
s
*
sizer
)
generatedCode
()
string
{
code
:=
Buffer
{}
code
:=
Buffer
{}
// prologue
// prologue
code
.
emit
(
"func (%s *%s) NEO
EncodedInfo() (uint16, int)
{"
,
s
.
recvName
,
s
.
typeName
)
code
.
emit
(
"func (%s *%s) NEO
PktEncodedLen() int
{"
,
s
.
recvName
,
s
.
typeName
)
if
s
.
varUsed
[
"size"
]
{
if
s
.
varUsed
[
"size"
]
{
code
.
emit
(
"var %s int"
,
s
.
var_
(
"size"
))
code
.
emit
(
"var %s int"
,
s
.
var_
(
"size"
))
}
}
...
@@ -539,7 +539,7 @@ func (s *sizer) generatedCode() string {
...
@@ -539,7 +539,7 @@ func (s *sizer) generatedCode() string {
if
s
.
varUsed
[
"size"
]
{
if
s
.
varUsed
[
"size"
]
{
size
+=
" + "
+
s
.
var_
(
"size"
)
size
+=
" + "
+
s
.
var_
(
"size"
)
}
}
code
.
emit
(
"return %v
, %v"
,
s
.
msgCode
,
size
)
code
.
emit
(
"return %v
"
,
size
)
code
.
emit
(
"}
\n
"
)
code
.
emit
(
"}
\n
"
)
return
code
.
String
()
return
code
.
String
()
...
@@ -548,7 +548,7 @@ func (s *sizer) generatedCode() string {
...
@@ -548,7 +548,7 @@ func (s *sizer) generatedCode() string {
func
(
e
*
encoder
)
generatedCode
()
string
{
func
(
e
*
encoder
)
generatedCode
()
string
{
code
:=
Buffer
{}
code
:=
Buffer
{}
// prologue
// prologue
code
.
emit
(
"func (%s *%s) NEOEncode(data []byte) {"
,
e
.
recvName
,
e
.
typeName
)
code
.
emit
(
"func (%s *%s) NEO
Pkt
Encode(data []byte) {"
,
e
.
recvName
,
e
.
typeName
)
code
.
Write
(
e
.
buf
.
Bytes
())
code
.
Write
(
e
.
buf
.
Bytes
())
...
@@ -655,7 +655,7 @@ func (d *decoder) generatedCode() string {
...
@@ -655,7 +655,7 @@ func (d *decoder) generatedCode() string {
code
:=
Buffer
{}
code
:=
Buffer
{}
// prologue
// prologue
code
.
emit
(
"func (%s *%s) NEODecode(data []byte) (int, error) {"
,
d
.
recvName
,
d
.
typeName
)
code
.
emit
(
"func (%s *%s) NEO
Pkt
Decode(data []byte) (int, error) {"
,
d
.
recvName
,
d
.
typeName
)
if
d
.
varUsed
[
"nread"
]
{
if
d
.
varUsed
[
"nread"
]
{
code
.
emit
(
"var %v uint32"
,
d
.
var_
(
"nread"
))
code
.
emit
(
"var %v uint32"
,
d
.
var_
(
"nread"
))
}
}
...
...
go/neo/server.go
View file @
65ff3185
...
@@ -94,6 +94,7 @@ func ListenAndServe(ctx context.Context, net Network, laddr string, srv Server)
...
@@ -94,6 +94,7 @@ func ListenAndServe(ctx context.Context, net Network, laddr string, srv Server)
// IdentifyPeer identifies peer on the link
// IdentifyPeer identifies peer on the link
// it expects peer to send RequestIdentification packet and replies with AcceptIdentification if identification passes.
// it expects peer to send RequestIdentification packet and replies with AcceptIdentification if identification passes.
// returns information about identified node or error.
// returns information about identified node or error.
// XXX recheck identification logic here
func
IdentifyPeer
(
link
*
NodeLink
,
myNodeType
NodeType
)
(
nodeInfo
RequestIdentification
/*TODO -> NodeInfo*/
,
err
error
)
{
func
IdentifyPeer
(
link
*
NodeLink
,
myNodeType
NodeType
)
(
nodeInfo
RequestIdentification
/*TODO -> NodeInfo*/
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"%s: identify"
,
link
)
defer
xerr
.
Contextf
(
&
err
,
"%s: identify"
,
link
)
...
@@ -137,6 +138,7 @@ func IdentifyPeer(link *NodeLink, myNodeType NodeType) (nodeInfo RequestIdentifi
...
@@ -137,6 +138,7 @@ func IdentifyPeer(link *NodeLink, myNodeType NodeType) (nodeInfo RequestIdentifi
// IdentifyWith identifies local node with remote peer
// IdentifyWith identifies local node with remote peer
// it also verifies peer's node type to what caller expects
// it also verifies peer's node type to what caller expects
// XXX place != ok (this is client, not server ?)
func
IdentifyWith
(
expectPeerType
NodeType
,
link
*
NodeLink
,
myInfo
NodeInfo
,
clusterName
string
)
(
accept
*
AcceptIdentification
,
err
error
)
{
func
IdentifyWith
(
expectPeerType
NodeType
,
link
*
NodeLink
,
myInfo
NodeInfo
,
clusterName
string
)
(
accept
*
AcceptIdentification
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"%s: request identification"
,
link
)
defer
xerr
.
Contextf
(
&
err
,
"%s: request identification"
,
link
)
...
@@ -176,7 +178,7 @@ func IdentifyWith(expectPeerType NodeType, link *NodeLink, myInfo NodeInfo, clus
...
@@ -176,7 +178,7 @@ func IdentifyWith(expectPeerType NodeType, link *NodeLink, myInfo NodeInfo, clus
// XXX naming for RecvAndDecode and EncodeAndSend
// XXX naming for RecvAndDecode and EncodeAndSend
// RecvAndDecode receives packet from conn and decodes it
// RecvAndDecode receives packet from conn and decodes it
func
RecvAndDecode
(
conn
*
Conn
)
(
NEO
Encoder
,
error
)
{
// XXX NEOEncoder -> interface{}
func
RecvAndDecode
(
conn
*
Conn
)
(
NEO
Pkt
,
error
)
{
pkt
,
err
:=
conn
.
Recv
()
pkt
,
err
:=
conn
.
Recv
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -194,8 +196,8 @@ func RecvAndDecode(conn *Conn) (NEOEncoder, error) { // XXX NEOEncoder -> interf
...
@@ -194,8 +196,8 @@ func RecvAndDecode(conn *Conn) (NEOEncoder, error) { // XXX NEOEncoder -> interf
}
}
// TODO use free-list for decoded packets + when possible decode in-place
// TODO use free-list for decoded packets + when possible decode in-place
pktObj
:=
reflect
.
New
(
msgType
)
.
Interface
()
.
(
NEO
Codec
)
pktObj
:=
reflect
.
New
(
msgType
)
.
Interface
()
.
(
NEO
Pkt
)
_
,
err
=
pktObj
.
NEODecode
(
pkt
.
Payload
())
_
,
err
=
pktObj
.
NEO
Pkt
Decode
(
pkt
.
Payload
())
if
err
!=
nil
{
if
err
!=
nil
{
// XXX -> ProtoError ?
// XXX -> ProtoError ?
return
nil
,
&
ConnError
{
Conn
:
conn
,
Op
:
"decode"
,
Err
:
err
}
return
nil
,
&
ConnError
{
Conn
:
conn
,
Op
:
"decode"
,
Err
:
err
}
...
@@ -205,23 +207,23 @@ func RecvAndDecode(conn *Conn) (NEOEncoder, error) { // XXX NEOEncoder -> interf
...
@@ -205,23 +207,23 @@ func RecvAndDecode(conn *Conn) (NEOEncoder, error) { // XXX NEOEncoder -> interf
}
}
// EncodeAndSend encodes pkt and sends it to conn
// EncodeAndSend encodes pkt and sends it to conn
func
EncodeAndSend
(
conn
*
Conn
,
pkt
NEO
Encoder
)
error
{
func
EncodeAndSend
(
conn
*
Conn
,
pkt
NEO
Pkt
)
error
{
msgCode
,
l
:=
pkt
.
NEOEncodedInfo
()
l
:=
pkt
.
NEOPktEncodedLen
()
buf
:=
PktBuf
{
make
([]
byte
,
PktHeadLen
+
l
)}
// XXX -> freelist
buf
:=
PktBuf
{
make
([]
byte
,
PktHeadLen
+
l
)}
// XXX -> freelist
h
:=
buf
.
Header
()
h
:=
buf
.
Header
()
// h.ConnId will be set by conn.Send
// h.ConnId will be set by conn.Send
h
.
MsgCode
=
hton16
(
msgCode
)
h
.
MsgCode
=
hton16
(
pkt
.
NEOPktMsgCode
()
)
h
.
MsgLen
=
hton32
(
uint32
(
l
))
// XXX casting: think again
h
.
MsgLen
=
hton32
(
uint32
(
l
))
// XXX casting: think again
pkt
.
NEOEncode
(
buf
.
Payload
())
pkt
.
NEO
Pkt
Encode
(
buf
.
Payload
())
return
conn
.
Send
(
&
buf
)
// XXX why pointer?
return
conn
.
Send
(
&
buf
)
// XXX why pointer?
}
}
// Ask does simple request/response protocol exchange
// Ask does simple request/response protocol exchange
// It expects the answer to be exactly of resp type and errors otherwise
// It expects the answer to be exactly of resp type and errors otherwise
func
Ask
(
conn
*
Conn
,
req
NEO
Encoder
,
resp
NEODecoder
)
error
{
func
Ask
(
conn
*
Conn
,
req
NEO
Pkt
,
resp
NEOPkt
)
error
{
err
:=
EncodeAndSend
(
conn
,
req
)
err
:=
EncodeAndSend
(
conn
,
req
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -246,7 +248,7 @@ func (e *ProtoError) Error() string {
...
@@ -246,7 +248,7 @@ func (e *ProtoError) Error() string {
// Expect receives 1 packet and expects it to be exactly of msg type
// Expect receives 1 packet and expects it to be exactly of msg type
// XXX naming (-> Recv1 ?)
// XXX naming (-> Recv1 ?)
func
Expect
(
conn
*
Conn
,
msg
NEO
Decoder
)
(
err
error
)
{
func
Expect
(
conn
*
Conn
,
msg
NEO
Pkt
)
(
err
error
)
{
pkt
,
err
:=
conn
.
Recv
()
pkt
,
err
:=
conn
.
Recv
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -267,7 +269,7 @@ func Expect(conn *Conn, msg NEODecoder) (err error) {
...
@@ -267,7 +269,7 @@ func Expect(conn *Conn, msg NEODecoder) (err error) {
// unexpected Error response
// unexpected Error response
if
msgType
==
reflect
.
TypeOf
(
Error
{})
{
if
msgType
==
reflect
.
TypeOf
(
Error
{})
{
errResp
:=
Error
{}
errResp
:=
Error
{}
_
,
err
=
errResp
.
NEODecode
(
pkt
.
Payload
())
_
,
err
=
errResp
.
NEO
Pkt
Decode
(
pkt
.
Payload
())
if
err
!=
nil
{
if
err
!=
nil
{
return
&
ProtoError
{
conn
,
err
}
return
&
ProtoError
{
conn
,
err
}
}
}
...
@@ -282,7 +284,7 @@ func Expect(conn *Conn, msg NEODecoder) (err error) {
...
@@ -282,7 +284,7 @@ func Expect(conn *Conn, msg NEODecoder) (err error) {
return
&
ProtoError
{
conn
,
fmt
.
Errorf
(
"unexpected packet: %v"
,
msgType
)}
return
&
ProtoError
{
conn
,
fmt
.
Errorf
(
"unexpected packet: %v"
,
msgType
)}
}
}
_
,
err
=
msg
.
NEODecode
(
pkt
.
Payload
())
_
,
err
=
msg
.
NEO
Pkt
Decode
(
pkt
.
Payload
())
if
err
!=
nil
{
if
err
!=
nil
{
return
&
ProtoError
{
conn
,
err
}
return
&
ProtoError
{
conn
,
err
}
}
}
...
...
go/neo/storage.go
View file @
65ff3185
...
@@ -312,7 +312,7 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *Conn) {
...
@@ -312,7 +312,7 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *Conn) {
xid
.
TidBefore
=
true
xid
.
TidBefore
=
true
}
}
var
reply
NEO
Encoder
var
reply
NEO
Pkt
data
,
tid
,
err
:=
stor
.
zstor
.
Load
(
xid
)
data
,
tid
,
err
:=
stor
.
zstor
.
Load
(
xid
)
if
err
!=
nil
{
if
err
!=
nil
{
// TODO translate err to NEO protocol error codes
// TODO translate err to NEO protocol error codes
...
@@ -334,7 +334,7 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *Conn) {
...
@@ -334,7 +334,7 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *Conn) {
EncodeAndSend
(
conn
,
reply
)
// XXX err
EncodeAndSend
(
conn
,
reply
)
// XXX err
case
*
LastTransaction
:
case
*
LastTransaction
:
var
reply
NEO
Encoder
var
reply
NEO
Pkt
lastTid
,
err
:=
stor
.
zstor
.
LastTid
()
lastTid
,
err
:=
stor
.
zstor
.
LastTid
()
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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