2014-09-22 21:42:11 +02:00
|
|
|
// ************************************************************
|
|
|
|
// This file is automatically generated by genxdr. Do not edit.
|
|
|
|
// ************************************************************
|
|
|
|
|
|
|
|
package protocol
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"github.com/calmh/xdr"
|
|
|
|
)
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
IndexMessage Structure:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-28 13:00:38 +02:00
|
|
|
| Length of Folder |
|
2014-09-22 21:42:11 +02:00
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2014-09-28 13:00:38 +02:00
|
|
|
\ Folder (variable length) \
|
2014-09-22 21:42:11 +02:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Files |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Zero or more FileInfo Structures \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct IndexMessage {
|
2014-09-28 13:00:38 +02:00
|
|
|
string Folder<64>;
|
2014-09-22 21:42:11 +02:00
|
|
|
FileInfo Files<>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func (o IndexMessage) EncodeXDR(w io.Writer) (int, error) {
|
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o IndexMessage) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o IndexMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o IndexMessage) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o IndexMessage) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.Folder); l > 64 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Folder", l, 64)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
2014-09-28 13:00:38 +02:00
|
|
|
xw.WriteString(o.Folder)
|
2014-09-22 21:42:11 +02:00
|
|
|
xw.WriteUint32(uint32(len(o.Files)))
|
|
|
|
for i := range o.Files {
|
|
|
|
_, err := o.Files[i].encodeXDR(xw)
|
|
|
|
if err != nil {
|
|
|
|
return xw.Tot(), err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *IndexMessage) DecodeXDR(r io.Reader) error {
|
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *IndexMessage) UnmarshalXDR(bs []byte) error {
|
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *IndexMessage) decodeXDR(xr *xdr.Reader) error {
|
2014-09-28 13:00:38 +02:00
|
|
|
o.Folder = xr.ReadStringMax(64)
|
2014-09-22 21:42:11 +02:00
|
|
|
_FilesSize := int(xr.ReadUint32())
|
|
|
|
o.Files = make([]FileInfo, _FilesSize)
|
|
|
|
for i := range o.Files {
|
|
|
|
(&o.Files[i]).decodeXDR(xr)
|
|
|
|
}
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
FileInfo Structure:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of Name |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Name (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Flags |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| |
|
|
|
|
+ Modified (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| |
|
|
|
|
+ Version (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| |
|
|
|
|
+ Local Version (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Blocks |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Zero or more BlockInfo Structures \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct FileInfo {
|
|
|
|
string Name<8192>;
|
|
|
|
unsigned int Flags;
|
|
|
|
hyper Modified;
|
|
|
|
unsigned hyper Version;
|
|
|
|
unsigned hyper LocalVersion;
|
|
|
|
BlockInfo Blocks<>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func (o FileInfo) EncodeXDR(w io.Writer) (int, error) {
|
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o FileInfo) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o FileInfo) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o FileInfo) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o FileInfo) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.Name); l > 8192 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteString(o.Name)
|
|
|
|
xw.WriteUint32(o.Flags)
|
|
|
|
xw.WriteUint64(uint64(o.Modified))
|
|
|
|
xw.WriteUint64(o.Version)
|
|
|
|
xw.WriteUint64(o.LocalVersion)
|
|
|
|
xw.WriteUint32(uint32(len(o.Blocks)))
|
|
|
|
for i := range o.Blocks {
|
|
|
|
_, err := o.Blocks[i].encodeXDR(xw)
|
|
|
|
if err != nil {
|
|
|
|
return xw.Tot(), err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *FileInfo) DecodeXDR(r io.Reader) error {
|
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *FileInfo) UnmarshalXDR(bs []byte) error {
|
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *FileInfo) decodeXDR(xr *xdr.Reader) error {
|
|
|
|
o.Name = xr.ReadStringMax(8192)
|
|
|
|
o.Flags = xr.ReadUint32()
|
|
|
|
o.Modified = int64(xr.ReadUint64())
|
|
|
|
o.Version = xr.ReadUint64()
|
|
|
|
o.LocalVersion = xr.ReadUint64()
|
|
|
|
_BlocksSize := int(xr.ReadUint32())
|
|
|
|
o.Blocks = make([]BlockInfo, _BlocksSize)
|
|
|
|
for i := range o.Blocks {
|
|
|
|
(&o.Blocks[i]).decodeXDR(xr)
|
|
|
|
}
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
FileInfoTruncated Structure:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of Name |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Name (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Flags |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| |
|
|
|
|
+ Modified (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| |
|
|
|
|
+ Version (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| |
|
|
|
|
+ Local Version (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Num Blocks |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct FileInfoTruncated {
|
|
|
|
string Name<8192>;
|
|
|
|
unsigned int Flags;
|
|
|
|
hyper Modified;
|
|
|
|
unsigned hyper Version;
|
|
|
|
unsigned hyper LocalVersion;
|
|
|
|
unsigned int NumBlocks;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func (o FileInfoTruncated) EncodeXDR(w io.Writer) (int, error) {
|
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o FileInfoTruncated) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o FileInfoTruncated) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o FileInfoTruncated) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o FileInfoTruncated) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.Name); l > 8192 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteString(o.Name)
|
|
|
|
xw.WriteUint32(o.Flags)
|
|
|
|
xw.WriteUint64(uint64(o.Modified))
|
|
|
|
xw.WriteUint64(o.Version)
|
|
|
|
xw.WriteUint64(o.LocalVersion)
|
|
|
|
xw.WriteUint32(o.NumBlocks)
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *FileInfoTruncated) DecodeXDR(r io.Reader) error {
|
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *FileInfoTruncated) UnmarshalXDR(bs []byte) error {
|
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *FileInfoTruncated) decodeXDR(xr *xdr.Reader) error {
|
|
|
|
o.Name = xr.ReadStringMax(8192)
|
|
|
|
o.Flags = xr.ReadUint32()
|
|
|
|
o.Modified = int64(xr.ReadUint64())
|
|
|
|
o.Version = xr.ReadUint64()
|
|
|
|
o.LocalVersion = xr.ReadUint64()
|
|
|
|
o.NumBlocks = xr.ReadUint32()
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
BlockInfo Structure:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Size |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of Hash |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Hash (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct BlockInfo {
|
|
|
|
unsigned int Size;
|
|
|
|
opaque Hash<64>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func (o BlockInfo) EncodeXDR(w io.Writer) (int, error) {
|
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o BlockInfo) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o BlockInfo) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o BlockInfo) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o BlockInfo) encodeXDR(xw *xdr.Writer) (int, error) {
|
|
|
|
xw.WriteUint32(o.Size)
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.Hash); l > 64 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Hash", l, 64)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteBytes(o.Hash)
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *BlockInfo) DecodeXDR(r io.Reader) error {
|
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *BlockInfo) UnmarshalXDR(bs []byte) error {
|
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *BlockInfo) decodeXDR(xr *xdr.Reader) error {
|
|
|
|
o.Size = xr.ReadUint32()
|
|
|
|
o.Hash = xr.ReadBytesMax(64)
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
RequestMessage Structure:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-28 13:00:38 +02:00
|
|
|
| Length of Folder |
|
2014-09-22 21:42:11 +02:00
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2014-09-28 13:00:38 +02:00
|
|
|
\ Folder (variable length) \
|
2014-09-22 21:42:11 +02:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of Name |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Name (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| |
|
|
|
|
+ Offset (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Size |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct RequestMessage {
|
2014-09-28 13:00:38 +02:00
|
|
|
string Folder<64>;
|
2014-09-22 21:42:11 +02:00
|
|
|
string Name<8192>;
|
|
|
|
unsigned hyper Offset;
|
|
|
|
unsigned int Size;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func (o RequestMessage) EncodeXDR(w io.Writer) (int, error) {
|
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o RequestMessage) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o RequestMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o RequestMessage) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o RequestMessage) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.Folder); l > 64 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Folder", l, 64)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
2014-09-28 13:00:38 +02:00
|
|
|
xw.WriteString(o.Folder)
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.Name); l > 8192 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteString(o.Name)
|
|
|
|
xw.WriteUint64(o.Offset)
|
|
|
|
xw.WriteUint32(o.Size)
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *RequestMessage) DecodeXDR(r io.Reader) error {
|
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *RequestMessage) UnmarshalXDR(bs []byte) error {
|
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *RequestMessage) decodeXDR(xr *xdr.Reader) error {
|
2014-09-28 13:00:38 +02:00
|
|
|
o.Folder = xr.ReadStringMax(64)
|
2014-09-22 21:42:11 +02:00
|
|
|
o.Name = xr.ReadStringMax(8192)
|
|
|
|
o.Offset = xr.ReadUint64()
|
|
|
|
o.Size = xr.ReadUint32()
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
ResponseMessage Structure:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of Data |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Data (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct ResponseMessage {
|
|
|
|
opaque Data<>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func (o ResponseMessage) EncodeXDR(w io.Writer) (int, error) {
|
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o ResponseMessage) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o ResponseMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o ResponseMessage) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o ResponseMessage) encodeXDR(xw *xdr.Writer) (int, error) {
|
|
|
|
xw.WriteBytes(o.Data)
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *ResponseMessage) DecodeXDR(r io.Reader) error {
|
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *ResponseMessage) UnmarshalXDR(bs []byte) error {
|
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *ResponseMessage) decodeXDR(xr *xdr.Reader) error {
|
|
|
|
o.Data = xr.ReadBytes()
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
ClusterConfigMessage Structure:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of Client Name |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Client Name (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of Client Version |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Client Version (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-28 13:00:38 +02:00
|
|
|
| Number of Folders |
|
2014-09-22 21:42:11 +02:00
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2014-09-28 13:00:38 +02:00
|
|
|
\ Zero or more Folder Structures \
|
2014-09-22 21:42:11 +02:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Options |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Zero or more Option Structures \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct ClusterConfigMessage {
|
|
|
|
string ClientName<64>;
|
|
|
|
string ClientVersion<64>;
|
2014-09-28 13:00:38 +02:00
|
|
|
Folder Folders<64>;
|
2014-09-22 21:42:11 +02:00
|
|
|
Option Options<64>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func (o ClusterConfigMessage) EncodeXDR(w io.Writer) (int, error) {
|
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o ClusterConfigMessage) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o ClusterConfigMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o ClusterConfigMessage) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o ClusterConfigMessage) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.ClientName); l > 64 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("ClientName", l, 64)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteString(o.ClientName)
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.ClientVersion); l > 64 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("ClientVersion", l, 64)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteString(o.ClientVersion)
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.Folders); l > 64 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Folders", l, 64)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
2014-09-28 13:00:38 +02:00
|
|
|
xw.WriteUint32(uint32(len(o.Folders)))
|
|
|
|
for i := range o.Folders {
|
|
|
|
_, err := o.Folders[i].encodeXDR(xw)
|
2014-09-22 21:42:11 +02:00
|
|
|
if err != nil {
|
|
|
|
return xw.Tot(), err
|
|
|
|
}
|
|
|
|
}
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.Options); l > 64 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteUint32(uint32(len(o.Options)))
|
|
|
|
for i := range o.Options {
|
|
|
|
_, err := o.Options[i].encodeXDR(xw)
|
|
|
|
if err != nil {
|
|
|
|
return xw.Tot(), err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *ClusterConfigMessage) DecodeXDR(r io.Reader) error {
|
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *ClusterConfigMessage) UnmarshalXDR(bs []byte) error {
|
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *ClusterConfigMessage) decodeXDR(xr *xdr.Reader) error {
|
|
|
|
o.ClientName = xr.ReadStringMax(64)
|
|
|
|
o.ClientVersion = xr.ReadStringMax(64)
|
2014-09-28 13:00:38 +02:00
|
|
|
_FoldersSize := int(xr.ReadUint32())
|
|
|
|
if _FoldersSize > 64 {
|
2014-10-21 08:40:05 +02:00
|
|
|
return xdr.ElementSizeExceeded("Folders", _FoldersSize, 64)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
2014-09-28 13:00:38 +02:00
|
|
|
o.Folders = make([]Folder, _FoldersSize)
|
|
|
|
for i := range o.Folders {
|
|
|
|
(&o.Folders[i]).decodeXDR(xr)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
_OptionsSize := int(xr.ReadUint32())
|
|
|
|
if _OptionsSize > 64 {
|
2014-10-21 08:40:05 +02:00
|
|
|
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
o.Options = make([]Option, _OptionsSize)
|
|
|
|
for i := range o.Options {
|
|
|
|
(&o.Options[i]).decodeXDR(xr)
|
|
|
|
}
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
Folder Structure:
|
2014-09-22 21:42:11 +02:00
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of ID |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ ID (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-28 13:00:38 +02:00
|
|
|
| Number of Devices |
|
2014-09-22 21:42:11 +02:00
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2014-09-28 13:00:38 +02:00
|
|
|
\ Zero or more Device Structures \
|
2014-09-22 21:42:11 +02:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
struct Folder {
|
2014-09-22 21:42:11 +02:00
|
|
|
string ID<64>;
|
2014-10-20 22:45:26 +02:00
|
|
|
Device Devices<>;
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
func (o Folder) EncodeXDR(w io.Writer) (int, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o Folder) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o Folder) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o Folder) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
func (o Folder) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.ID); l > 64 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 64)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteString(o.ID)
|
2014-09-28 13:00:38 +02:00
|
|
|
xw.WriteUint32(uint32(len(o.Devices)))
|
|
|
|
for i := range o.Devices {
|
|
|
|
_, err := o.Devices[i].encodeXDR(xw)
|
2014-09-22 21:42:11 +02:00
|
|
|
if err != nil {
|
|
|
|
return xw.Tot(), err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
func (o *Folder) DecodeXDR(r io.Reader) error {
|
2014-09-22 21:42:11 +02:00
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
func (o *Folder) UnmarshalXDR(bs []byte) error {
|
2014-09-22 21:42:11 +02:00
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
func (o *Folder) decodeXDR(xr *xdr.Reader) error {
|
2014-09-22 21:42:11 +02:00
|
|
|
o.ID = xr.ReadStringMax(64)
|
2014-09-28 13:00:38 +02:00
|
|
|
_DevicesSize := int(xr.ReadUint32())
|
|
|
|
o.Devices = make([]Device, _DevicesSize)
|
|
|
|
for i := range o.Devices {
|
|
|
|
(&o.Devices[i]).decodeXDR(xr)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
Device Structure:
|
2014-09-22 21:42:11 +02:00
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of ID |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ ID (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Flags |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| |
|
|
|
|
+ Max Local Version (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
struct Device {
|
2014-09-22 21:42:11 +02:00
|
|
|
opaque ID<32>;
|
|
|
|
unsigned int Flags;
|
|
|
|
unsigned hyper MaxLocalVersion;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
func (o Device) EncodeXDR(w io.Writer) (int, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o Device) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o Device) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o Device) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
func (o Device) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.ID); l > 32 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 32)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteBytes(o.ID)
|
|
|
|
xw.WriteUint32(o.Flags)
|
|
|
|
xw.WriteUint64(o.MaxLocalVersion)
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
func (o *Device) DecodeXDR(r io.Reader) error {
|
2014-09-22 21:42:11 +02:00
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
func (o *Device) UnmarshalXDR(bs []byte) error {
|
2014-09-22 21:42:11 +02:00
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
2014-09-28 13:00:38 +02:00
|
|
|
func (o *Device) decodeXDR(xr *xdr.Reader) error {
|
2014-09-22 21:42:11 +02:00
|
|
|
o.ID = xr.ReadBytesMax(32)
|
|
|
|
o.Flags = xr.ReadUint32()
|
|
|
|
o.MaxLocalVersion = xr.ReadUint64()
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Option Structure:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of Key |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Key (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of Value |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Value (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct Option {
|
|
|
|
string Key<64>;
|
|
|
|
string Value<1024>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func (o Option) EncodeXDR(w io.Writer) (int, error) {
|
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o Option) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o Option) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o Option) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o Option) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.Key); l > 64 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Key", l, 64)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteString(o.Key)
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.Value); l > 1024 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Value", l, 1024)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteString(o.Value)
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *Option) DecodeXDR(r io.Reader) error {
|
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *Option) UnmarshalXDR(bs []byte) error {
|
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *Option) decodeXDR(xr *xdr.Reader) error {
|
|
|
|
o.Key = xr.ReadStringMax(64)
|
|
|
|
o.Value = xr.ReadStringMax(1024)
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
CloseMessage Structure:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of Reason |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Reason (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct CloseMessage {
|
|
|
|
string Reason<1024>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func (o CloseMessage) EncodeXDR(w io.Writer) (int, error) {
|
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o CloseMessage) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o CloseMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o CloseMessage) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o CloseMessage) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-10-21 08:40:05 +02:00
|
|
|
if l := len(o.Reason); l > 1024 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Reason", l, 1024)
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
xw.WriteString(o.Reason)
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *CloseMessage) DecodeXDR(r io.Reader) error {
|
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *CloseMessage) UnmarshalXDR(bs []byte) error {
|
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *CloseMessage) decodeXDR(xr *xdr.Reader) error {
|
|
|
|
o.Reason = xr.ReadStringMax(1024)
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
EmptyMessage Structure:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct EmptyMessage {
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func (o EmptyMessage) EncodeXDR(w io.Writer) (int, error) {
|
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o EmptyMessage) MarshalXDR() ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-21 08:40:05 +02:00
|
|
|
func (o EmptyMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o EmptyMessage) AppendXDR(bs []byte) ([]byte, error) {
|
2014-09-22 21:42:11 +02:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-21 08:40:05 +02:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-09-22 21:42:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o EmptyMessage) encodeXDR(xw *xdr.Writer) (int, error) {
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *EmptyMessage) DecodeXDR(r io.Reader) error {
|
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *EmptyMessage) UnmarshalXDR(bs []byte) error {
|
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *EmptyMessage) decodeXDR(xr *xdr.Reader) error {
|
|
|
|
return xr.Error()
|
|
|
|
}
|