Commit d5fb4ac4 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2ad63c2c
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// //
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// NEO | Work with bigendian data // NEO | Bigendian/native conversion
package neo package neo
...@@ -23,6 +23,8 @@ type be16 uint16 ...@@ -23,6 +23,8 @@ type be16 uint16
type be32 uint32 type be32 uint32
type be64 uint64 type be64 uint64
// XXX naming ntoh{s,l,q} ?
func ntoh16(v be16) uint16 { func ntoh16(v be16) uint16 {
b := (*[2]byte)(unsafe.Pointer(&v)) b := (*[2]byte)(unsafe.Pointer(&v))
return binary.BigEndian.Uint16(b[:]) return binary.BigEndian.Uint16(b[:])
......
...@@ -127,9 +127,9 @@ type RowInfo struct { ...@@ -127,9 +127,9 @@ type RowInfo struct {
// XXX link request <-> answer ? // XXX link request <-> answer ?
// TODO ensure len(encoded packet header) == 10 // TODO ensure len(encoded packet header) == 10
type PktHead struct { type PktHead struct {
Id uint32 // XXX -> MsgId and same vvv ? MsgId be32
Code uint16 // XXX we don't need this as field - this is already encoded in type MsgCode be16
Len uint32 // XXX we don't need this as field - only on the wire Len be32 // whole packet length (including header)
} }
// TODO generate .Encode() / .Decode() // TODO generate .Encode() / .Decode()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment