2014-09-22 12:42:11 -07:00
|
|
|
// ************************************************************
|
|
|
|
// This file is automatically generated by genxdr. Do not edit.
|
|
|
|
// ************************************************************
|
|
|
|
|
|
|
|
package protocol
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/calmh/xdr"
|
|
|
|
)
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2016-03-25 13:29:07 -07:00
|
|
|
HelloMessage 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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Device Name (length + padded data) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Client Name (length + padded data) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Client Version (length + padded data) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct HelloMessage {
|
|
|
|
string DeviceName<64>;
|
|
|
|
string ClientName<64>;
|
|
|
|
string ClientVersion<64>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func (o HelloMessage) XDRSize() int {
|
|
|
|
return 4 + len(o.DeviceName) + xdr.Padding(len(o.DeviceName)) +
|
|
|
|
4 + len(o.ClientName) + xdr.Padding(len(o.ClientName)) +
|
|
|
|
4 + len(o.ClientVersion) + xdr.Padding(len(o.ClientVersion))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o HelloMessage) MarshalXDR() ([]byte, error) {
|
|
|
|
buf := make([]byte, o.XDRSize())
|
|
|
|
m := &xdr.Marshaller{Data: buf}
|
|
|
|
return buf, o.MarshalXDRInto(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o HelloMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o HelloMessage) MarshalXDRInto(m *xdr.Marshaller) error {
|
|
|
|
if l := len(o.DeviceName); l > 64 {
|
|
|
|
return xdr.ElementSizeExceeded("DeviceName", l, 64)
|
|
|
|
}
|
|
|
|
m.MarshalString(o.DeviceName)
|
|
|
|
if l := len(o.ClientName); l > 64 {
|
|
|
|
return xdr.ElementSizeExceeded("ClientName", l, 64)
|
|
|
|
}
|
|
|
|
m.MarshalString(o.ClientName)
|
|
|
|
if l := len(o.ClientVersion); l > 64 {
|
|
|
|
return xdr.ElementSizeExceeded("ClientVersion", l, 64)
|
|
|
|
}
|
|
|
|
m.MarshalString(o.ClientVersion)
|
|
|
|
return m.Error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *HelloMessage) UnmarshalXDR(bs []byte) error {
|
|
|
|
u := &xdr.Unmarshaller{Data: bs}
|
|
|
|
return o.UnmarshalXDRFrom(u)
|
|
|
|
}
|
|
|
|
func (o *HelloMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
o.DeviceName = u.UnmarshalStringMax(64)
|
|
|
|
o.ClientName = u.UnmarshalStringMax(64)
|
|
|
|
o.ClientVersion = u.UnmarshalStringMax(64)
|
|
|
|
return u.Error
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2014-09-22 12:42:11 -07:00
|
|
|
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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Folder (length + padded data) \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Files |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Zero or more FileInfo Structures \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2015-01-08 02:28:39 -07:00
|
|
|
| Flags |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Options |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Zero or more Option Structures \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-22 12:42:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
struct IndexMessage {
|
2015-09-24 10:51:59 -07:00
|
|
|
string Folder<256>;
|
2015-08-17 23:41:34 -07:00
|
|
|
FileInfo Files<1000000>;
|
2015-01-08 02:28:39 -07:00
|
|
|
unsigned int Flags;
|
|
|
|
Option Options<64>;
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o IndexMessage) XDRSize() int {
|
|
|
|
return 4 + len(o.Folder) + xdr.Padding(len(o.Folder)) +
|
|
|
|
4 + xdr.SizeOfSlice(o.Files) + 4 +
|
|
|
|
4 + xdr.SizeOfSlice(o.Options)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o IndexMessage) MarshalXDR() ([]byte, error) {
|
2016-02-02 04:44:33 -07:00
|
|
|
buf := make([]byte, o.XDRSize())
|
|
|
|
m := &xdr.Marshaller{Data: buf}
|
|
|
|
return buf, o.MarshalXDRInto(m)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o IndexMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o IndexMessage) MarshalXDRInto(m *xdr.Marshaller) error {
|
2015-09-24 10:51:59 -07:00
|
|
|
if l := len(o.Folder); l > 256 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Folder", l, 256)
|
2015-09-24 10:51:59 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalString(o.Folder)
|
2015-08-17 23:41:34 -07:00
|
|
|
if l := len(o.Files); l > 1000000 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Files", l, 1000000)
|
2015-08-17 23:41:34 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(uint32(len(o.Files)))
|
2014-09-22 12:42:11 -07:00
|
|
|
for i := range o.Files {
|
2016-02-02 04:44:33 -07:00
|
|
|
if err := o.Files[i].MarshalXDRInto(m); err != nil {
|
|
|
|
return err
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(o.Flags)
|
2015-01-08 02:28:39 -07:00
|
|
|
if l := len(o.Options); l > 64 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Options", l, 64)
|
2015-01-08 02:28:39 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(uint32(len(o.Options)))
|
2015-01-08 02:28:39 -07:00
|
|
|
for i := range o.Options {
|
2016-02-02 04:44:33 -07:00
|
|
|
if err := o.Options[i].MarshalXDRInto(m); err != nil {
|
|
|
|
return err
|
2015-01-08 02:28:39 -07:00
|
|
|
}
|
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return m.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *IndexMessage) UnmarshalXDR(bs []byte) error {
|
2016-02-02 04:44:33 -07:00
|
|
|
u := &xdr.Unmarshaller{Data: bs}
|
|
|
|
return o.UnmarshalXDRFrom(u)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o *IndexMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
o.Folder = u.UnmarshalStringMax(256)
|
|
|
|
_FilesSize := int(u.UnmarshalUint32())
|
2015-04-08 05:46:08 -07:00
|
|
|
if _FilesSize < 0 {
|
2015-08-17 23:41:34 -07:00
|
|
|
return xdr.ElementSizeExceeded("Files", _FilesSize, 1000000)
|
2016-02-02 04:44:33 -07:00
|
|
|
} else if _FilesSize == 0 {
|
|
|
|
o.Files = nil
|
|
|
|
} else {
|
|
|
|
if _FilesSize > 1000000 {
|
|
|
|
return xdr.ElementSizeExceeded("Files", _FilesSize, 1000000)
|
|
|
|
}
|
|
|
|
if _FilesSize <= len(o.Files) {
|
|
|
|
o.Files = o.Files[:_FilesSize]
|
|
|
|
} else {
|
|
|
|
o.Files = make([]FileInfo, _FilesSize)
|
|
|
|
}
|
|
|
|
for i := range o.Files {
|
|
|
|
(&o.Files[i]).UnmarshalXDRFrom(u)
|
|
|
|
}
|
2015-08-17 23:41:34 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
o.Flags = u.UnmarshalUint32()
|
|
|
|
_OptionsSize := int(u.UnmarshalUint32())
|
2015-04-08 05:46:08 -07:00
|
|
|
if _OptionsSize < 0 {
|
|
|
|
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
2016-02-02 04:44:33 -07:00
|
|
|
} else if _OptionsSize == 0 {
|
|
|
|
o.Options = nil
|
|
|
|
} else {
|
|
|
|
if _OptionsSize > 64 {
|
|
|
|
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
|
|
|
}
|
|
|
|
if _OptionsSize <= len(o.Options) {
|
|
|
|
o.Options = o.Options[:_OptionsSize]
|
|
|
|
} else {
|
|
|
|
o.Options = make([]Option, _OptionsSize)
|
|
|
|
}
|
|
|
|
for i := range o.Options {
|
|
|
|
(&o.Options[i]).UnmarshalXDRFrom(u)
|
|
|
|
}
|
2015-04-08 05:46:08 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return u.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Name (length + padded data) \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Flags |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| |
|
|
|
|
+ Modified (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2015-03-20 01:58:32 -07:00
|
|
|
/ /
|
|
|
|
\ Vector Structure \
|
|
|
|
/ /
|
2014-09-22 12:42:11 -07:00
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| |
|
|
|
|
+ Local Version (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Blocks |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Zero or more BlockInfo Structures \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct FileInfo {
|
|
|
|
string Name<8192>;
|
|
|
|
unsigned int Flags;
|
|
|
|
hyper Modified;
|
2015-03-20 01:58:32 -07:00
|
|
|
Vector Version;
|
2015-01-17 17:26:52 -07:00
|
|
|
hyper LocalVersion;
|
2016-02-19 12:47:31 -07:00
|
|
|
BlockInfo Blocks<10000000>;
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o FileInfo) XDRSize() int {
|
|
|
|
return 4 + len(o.Name) + xdr.Padding(len(o.Name)) + 4 + 8 +
|
|
|
|
o.Version.XDRSize() + 8 +
|
|
|
|
4 + xdr.SizeOfSlice(o.Blocks)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o FileInfo) MarshalXDR() ([]byte, error) {
|
2016-02-02 04:44:33 -07:00
|
|
|
buf := make([]byte, o.XDRSize())
|
|
|
|
m := &xdr.Marshaller{Data: buf}
|
|
|
|
return buf, o.MarshalXDRInto(m)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o FileInfo) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o FileInfo) MarshalXDRInto(m *xdr.Marshaller) error {
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.Name); l > 8192 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Name", l, 8192)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalString(o.Name)
|
|
|
|
m.MarshalUint32(o.Flags)
|
|
|
|
m.MarshalUint64(uint64(o.Modified))
|
|
|
|
if err := o.Version.MarshalXDRInto(m); err != nil {
|
|
|
|
return err
|
2015-03-20 01:58:32 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint64(uint64(o.LocalVersion))
|
2016-02-19 12:47:31 -07:00
|
|
|
if l := len(o.Blocks); l > 10000000 {
|
|
|
|
return xdr.ElementSizeExceeded("Blocks", l, 10000000)
|
2015-08-17 23:41:34 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(uint32(len(o.Blocks)))
|
2014-09-22 12:42:11 -07:00
|
|
|
for i := range o.Blocks {
|
2016-02-02 04:44:33 -07:00
|
|
|
if err := o.Blocks[i].MarshalXDRInto(m); err != nil {
|
|
|
|
return err
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return m.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *FileInfo) UnmarshalXDR(bs []byte) error {
|
2016-02-02 04:44:33 -07:00
|
|
|
u := &xdr.Unmarshaller{Data: bs}
|
|
|
|
return o.UnmarshalXDRFrom(u)
|
|
|
|
}
|
|
|
|
func (o *FileInfo) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
o.Name = u.UnmarshalStringMax(8192)
|
|
|
|
o.Flags = u.UnmarshalUint32()
|
|
|
|
o.Modified = int64(u.UnmarshalUint64())
|
|
|
|
(&o.Version).UnmarshalXDRFrom(u)
|
|
|
|
o.LocalVersion = int64(u.UnmarshalUint64())
|
|
|
|
_BlocksSize := int(u.UnmarshalUint32())
|
2015-04-08 05:46:08 -07:00
|
|
|
if _BlocksSize < 0 {
|
2016-02-19 12:47:31 -07:00
|
|
|
return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
|
2016-02-02 04:44:33 -07:00
|
|
|
} else if _BlocksSize == 0 {
|
|
|
|
o.Blocks = nil
|
|
|
|
} else {
|
2016-02-19 12:47:31 -07:00
|
|
|
if _BlocksSize > 10000000 {
|
|
|
|
return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
|
2016-02-02 04:44:33 -07:00
|
|
|
}
|
|
|
|
if _BlocksSize <= len(o.Blocks) {
|
|
|
|
o.Blocks = o.Blocks[:_BlocksSize]
|
|
|
|
} else {
|
|
|
|
o.Blocks = make([]BlockInfo, _BlocksSize)
|
|
|
|
}
|
|
|
|
for i := range o.Blocks {
|
|
|
|
(&o.Blocks[i]).UnmarshalXDRFrom(u)
|
|
|
|
}
|
2015-08-17 23:41:34 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return u.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
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 |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Hash (length + padded data) \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct BlockInfo {
|
2015-01-17 17:26:52 -07:00
|
|
|
int Size;
|
2014-09-22 12:42:11 -07:00
|
|
|
opaque Hash<64>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o BlockInfo) XDRSize() int {
|
|
|
|
return 4 +
|
|
|
|
4 + len(o.Hash) + xdr.Padding(len(o.Hash))
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o BlockInfo) MarshalXDR() ([]byte, error) {
|
2016-02-02 04:44:33 -07:00
|
|
|
buf := make([]byte, o.XDRSize())
|
|
|
|
m := &xdr.Marshaller{Data: buf}
|
|
|
|
return buf, o.MarshalXDRInto(m)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o BlockInfo) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o BlockInfo) MarshalXDRInto(m *xdr.Marshaller) error {
|
|
|
|
m.MarshalUint32(uint32(o.Size))
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.Hash); l > 64 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Hash", l, 64)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalBytes(o.Hash)
|
|
|
|
return m.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *BlockInfo) UnmarshalXDR(bs []byte) error {
|
2016-02-02 04:44:33 -07:00
|
|
|
u := &xdr.Unmarshaller{Data: bs}
|
|
|
|
return o.UnmarshalXDRFrom(u)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o *BlockInfo) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
o.Size = int32(u.UnmarshalUint32())
|
|
|
|
o.Hash = u.UnmarshalBytesMax(64)
|
|
|
|
return u.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Folder (length + padded data) \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Name (length + padded data) \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| |
|
|
|
|
+ Offset (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Size |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2015-01-08 02:28:39 -07:00
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Hash (length + padded data) \
|
2015-01-08 02:28:39 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Flags |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Options |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Zero or more Option Structures \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-22 12:42:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
struct RequestMessage {
|
2015-09-24 10:51:59 -07:00
|
|
|
string Folder<256>;
|
2014-09-22 12:42:11 -07:00
|
|
|
string Name<8192>;
|
2015-01-17 17:26:52 -07:00
|
|
|
hyper Offset;
|
|
|
|
int Size;
|
2015-01-08 02:28:39 -07:00
|
|
|
opaque Hash<64>;
|
|
|
|
unsigned int Flags;
|
|
|
|
Option Options<64>;
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o RequestMessage) XDRSize() int {
|
|
|
|
return 4 + len(o.Folder) + xdr.Padding(len(o.Folder)) +
|
|
|
|
4 + len(o.Name) + xdr.Padding(len(o.Name)) + 8 + 4 +
|
|
|
|
4 + len(o.Hash) + xdr.Padding(len(o.Hash)) + 4 +
|
|
|
|
4 + xdr.SizeOfSlice(o.Options)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o RequestMessage) MarshalXDR() ([]byte, error) {
|
2016-02-02 04:44:33 -07:00
|
|
|
buf := make([]byte, o.XDRSize())
|
|
|
|
m := &xdr.Marshaller{Data: buf}
|
|
|
|
return buf, o.MarshalXDRInto(m)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o RequestMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o RequestMessage) MarshalXDRInto(m *xdr.Marshaller) error {
|
2015-09-24 10:51:59 -07:00
|
|
|
if l := len(o.Folder); l > 256 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Folder", l, 256)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalString(o.Folder)
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.Name); l > 8192 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Name", l, 8192)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalString(o.Name)
|
|
|
|
m.MarshalUint64(uint64(o.Offset))
|
|
|
|
m.MarshalUint32(uint32(o.Size))
|
2015-01-08 02:28:39 -07:00
|
|
|
if l := len(o.Hash); l > 64 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Hash", l, 64)
|
2015-01-08 02:28:39 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalBytes(o.Hash)
|
|
|
|
m.MarshalUint32(o.Flags)
|
2015-01-08 02:28:39 -07:00
|
|
|
if l := len(o.Options); l > 64 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Options", l, 64)
|
2015-01-08 02:28:39 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(uint32(len(o.Options)))
|
2015-01-08 02:28:39 -07:00
|
|
|
for i := range o.Options {
|
2016-02-02 04:44:33 -07:00
|
|
|
if err := o.Options[i].MarshalXDRInto(m); err != nil {
|
|
|
|
return err
|
2015-01-08 02:28:39 -07:00
|
|
|
}
|
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return m.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *RequestMessage) UnmarshalXDR(bs []byte) error {
|
2016-02-02 04:44:33 -07:00
|
|
|
u := &xdr.Unmarshaller{Data: bs}
|
|
|
|
return o.UnmarshalXDRFrom(u)
|
|
|
|
}
|
|
|
|
func (o *RequestMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
o.Folder = u.UnmarshalStringMax(256)
|
|
|
|
o.Name = u.UnmarshalStringMax(8192)
|
|
|
|
o.Offset = int64(u.UnmarshalUint64())
|
|
|
|
o.Size = int32(u.UnmarshalUint32())
|
|
|
|
o.Hash = u.UnmarshalBytesMax(64)
|
|
|
|
o.Flags = u.UnmarshalUint32()
|
|
|
|
_OptionsSize := int(u.UnmarshalUint32())
|
2015-04-08 05:46:08 -07:00
|
|
|
if _OptionsSize < 0 {
|
|
|
|
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
2016-02-02 04:44:33 -07:00
|
|
|
} else if _OptionsSize == 0 {
|
|
|
|
o.Options = nil
|
|
|
|
} else {
|
|
|
|
if _OptionsSize > 64 {
|
|
|
|
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
|
|
|
}
|
|
|
|
if _OptionsSize <= len(o.Options) {
|
|
|
|
o.Options = o.Options[:_OptionsSize]
|
|
|
|
} else {
|
|
|
|
o.Options = make([]Option, _OptionsSize)
|
|
|
|
}
|
|
|
|
for i := range o.Options {
|
|
|
|
(&o.Options[i]).UnmarshalXDRFrom(u)
|
|
|
|
}
|
2015-04-08 05:46:08 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return u.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Data (length + padded data) \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2015-02-06 14:34:51 -07:00
|
|
|
| Code |
|
2015-01-08 02:28:39 -07:00
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-22 12:42:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
struct ResponseMessage {
|
|
|
|
opaque Data<>;
|
2015-02-06 14:34:51 -07:00
|
|
|
int Code;
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o ResponseMessage) XDRSize() int {
|
|
|
|
return 4 + len(o.Data) + xdr.Padding(len(o.Data)) + 4
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o ResponseMessage) MarshalXDR() ([]byte, error) {
|
2016-02-02 04:44:33 -07:00
|
|
|
buf := make([]byte, o.XDRSize())
|
|
|
|
m := &xdr.Marshaller{Data: buf}
|
|
|
|
return buf, o.MarshalXDRInto(m)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o ResponseMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o ResponseMessage) MarshalXDRInto(m *xdr.Marshaller) error {
|
|
|
|
m.MarshalBytes(o.Data)
|
|
|
|
m.MarshalUint32(uint32(o.Code))
|
|
|
|
return m.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *ResponseMessage) UnmarshalXDR(bs []byte) error {
|
2016-02-02 04:44:33 -07:00
|
|
|
u := &xdr.Unmarshaller{Data: bs}
|
|
|
|
return o.UnmarshalXDRFrom(u)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o *ResponseMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
o.Data = u.UnmarshalBytes()
|
|
|
|
o.Code = int32(u.UnmarshalUint32())
|
|
|
|
return u.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-28 04:00:38 -07:00
|
|
|
| Number of Folders |
|
2014-09-22 12:42:11 -07:00
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2014-09-28 04:00:38 -07:00
|
|
|
\ Zero or more Folder Structures \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Options |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Zero or more Option Structures \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct ClusterConfigMessage {
|
2015-08-17 23:41:34 -07:00
|
|
|
Folder Folders<1000000>;
|
2014-09-22 12:42:11 -07:00
|
|
|
Option Options<64>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o ClusterConfigMessage) XDRSize() int {
|
2016-03-25 13:29:07 -07:00
|
|
|
return 4 + xdr.SizeOfSlice(o.Folders) +
|
2016-02-02 04:44:33 -07:00
|
|
|
4 + xdr.SizeOfSlice(o.Options)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o ClusterConfigMessage) MarshalXDR() ([]byte, error) {
|
2016-02-02 04:44:33 -07:00
|
|
|
buf := make([]byte, o.XDRSize())
|
|
|
|
m := &xdr.Marshaller{Data: buf}
|
|
|
|
return buf, o.MarshalXDRInto(m)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o ClusterConfigMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o ClusterConfigMessage) MarshalXDRInto(m *xdr.Marshaller) error {
|
2015-08-17 23:41:34 -07:00
|
|
|
if l := len(o.Folders); l > 1000000 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Folders", l, 1000000)
|
2015-08-17 23:41:34 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(uint32(len(o.Folders)))
|
2014-09-28 04:00:38 -07:00
|
|
|
for i := range o.Folders {
|
2016-02-02 04:44:33 -07:00
|
|
|
if err := o.Folders[i].MarshalXDRInto(m); err != nil {
|
|
|
|
return err
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
}
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.Options); l > 64 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Options", l, 64)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(uint32(len(o.Options)))
|
2014-09-22 12:42:11 -07:00
|
|
|
for i := range o.Options {
|
2016-02-02 04:44:33 -07:00
|
|
|
if err := o.Options[i].MarshalXDRInto(m); err != nil {
|
|
|
|
return err
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return m.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *ClusterConfigMessage) UnmarshalXDR(bs []byte) error {
|
2016-02-02 04:44:33 -07:00
|
|
|
u := &xdr.Unmarshaller{Data: bs}
|
|
|
|
return o.UnmarshalXDRFrom(u)
|
|
|
|
}
|
|
|
|
func (o *ClusterConfigMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
_FoldersSize := int(u.UnmarshalUint32())
|
2015-04-08 05:46:08 -07:00
|
|
|
if _FoldersSize < 0 {
|
2015-08-17 23:41:34 -07:00
|
|
|
return xdr.ElementSizeExceeded("Folders", _FoldersSize, 1000000)
|
2016-02-02 04:44:33 -07:00
|
|
|
} else if _FoldersSize == 0 {
|
|
|
|
o.Folders = nil
|
|
|
|
} else {
|
|
|
|
if _FoldersSize > 1000000 {
|
|
|
|
return xdr.ElementSizeExceeded("Folders", _FoldersSize, 1000000)
|
|
|
|
}
|
|
|
|
if _FoldersSize <= len(o.Folders) {
|
|
|
|
o.Folders = o.Folders[:_FoldersSize]
|
|
|
|
} else {
|
|
|
|
o.Folders = make([]Folder, _FoldersSize)
|
|
|
|
}
|
|
|
|
for i := range o.Folders {
|
|
|
|
(&o.Folders[i]).UnmarshalXDRFrom(u)
|
|
|
|
}
|
2015-08-17 23:41:34 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
_OptionsSize := int(u.UnmarshalUint32())
|
2015-04-08 05:46:08 -07:00
|
|
|
if _OptionsSize < 0 {
|
|
|
|
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
2016-02-02 04:44:33 -07:00
|
|
|
} else if _OptionsSize == 0 {
|
|
|
|
o.Options = nil
|
|
|
|
} else {
|
|
|
|
if _OptionsSize > 64 {
|
|
|
|
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
|
|
|
}
|
|
|
|
if _OptionsSize <= len(o.Options) {
|
|
|
|
o.Options = o.Options[:_OptionsSize]
|
|
|
|
} else {
|
|
|
|
o.Options = make([]Option, _OptionsSize)
|
|
|
|
}
|
|
|
|
for i := range o.Options {
|
|
|
|
(&o.Options[i]).UnmarshalXDRFrom(u)
|
|
|
|
}
|
2015-04-08 05:46:08 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return u.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
Folder Structure:
|
2014-09-22 12:42:11 -07: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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ ID (length + padded data) \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2016-03-11 02:48:46 -07:00
|
|
|
/ /
|
|
|
|
\ Label (length + padded data) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-28 04:00:38 -07:00
|
|
|
| Number of Devices |
|
2014-09-22 12:42:11 -07:00
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2014-09-28 04:00:38 -07:00
|
|
|
\ Zero or more Device Structures \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2015-03-25 13:20:04 -07:00
|
|
|
| Flags |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Options |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Zero or more Option Structures \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-22 12:42:11 -07:00
|
|
|
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
struct Folder {
|
2015-09-24 10:51:59 -07:00
|
|
|
string ID<256>;
|
2016-03-11 02:48:46 -07:00
|
|
|
string Label<256>;
|
2015-08-17 23:41:34 -07:00
|
|
|
Device Devices<1000000>;
|
2015-03-25 13:20:04 -07:00
|
|
|
unsigned int Flags;
|
|
|
|
Option Options<64>;
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o Folder) XDRSize() int {
|
|
|
|
return 4 + len(o.ID) + xdr.Padding(len(o.ID)) +
|
2016-03-11 02:48:46 -07:00
|
|
|
4 + len(o.Label) + xdr.Padding(len(o.Label)) +
|
2016-02-02 04:44:33 -07:00
|
|
|
4 + xdr.SizeOfSlice(o.Devices) + 4 +
|
|
|
|
4 + xdr.SizeOfSlice(o.Options)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Folder) MarshalXDR() ([]byte, error) {
|
2016-02-02 04:44:33 -07:00
|
|
|
buf := make([]byte, o.XDRSize())
|
|
|
|
m := &xdr.Marshaller{Data: buf}
|
|
|
|
return buf, o.MarshalXDRInto(m)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Folder) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o Folder) MarshalXDRInto(m *xdr.Marshaller) error {
|
2015-09-24 10:51:59 -07:00
|
|
|
if l := len(o.ID); l > 256 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("ID", l, 256)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalString(o.ID)
|
2016-03-11 02:48:46 -07:00
|
|
|
if l := len(o.Label); l > 256 {
|
|
|
|
return xdr.ElementSizeExceeded("Label", l, 256)
|
|
|
|
}
|
|
|
|
m.MarshalString(o.Label)
|
2015-08-17 23:41:34 -07:00
|
|
|
if l := len(o.Devices); l > 1000000 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Devices", l, 1000000)
|
2015-08-17 23:41:34 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(uint32(len(o.Devices)))
|
2014-09-28 04:00:38 -07:00
|
|
|
for i := range o.Devices {
|
2016-02-02 04:44:33 -07:00
|
|
|
if err := o.Devices[i].MarshalXDRInto(m); err != nil {
|
|
|
|
return err
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(o.Flags)
|
2015-03-25 13:20:04 -07:00
|
|
|
if l := len(o.Options); l > 64 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Options", l, 64)
|
2015-03-25 13:20:04 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(uint32(len(o.Options)))
|
2015-03-25 13:20:04 -07:00
|
|
|
for i := range o.Options {
|
2016-02-02 04:44:33 -07:00
|
|
|
if err := o.Options[i].MarshalXDRInto(m); err != nil {
|
|
|
|
return err
|
2015-03-25 13:20:04 -07:00
|
|
|
}
|
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return m.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
func (o *Folder) UnmarshalXDR(bs []byte) error {
|
2016-02-02 04:44:33 -07:00
|
|
|
u := &xdr.Unmarshaller{Data: bs}
|
|
|
|
return o.UnmarshalXDRFrom(u)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o *Folder) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
o.ID = u.UnmarshalStringMax(256)
|
2016-03-11 02:48:46 -07:00
|
|
|
o.Label = u.UnmarshalStringMax(256)
|
2016-02-02 04:44:33 -07:00
|
|
|
_DevicesSize := int(u.UnmarshalUint32())
|
2015-04-08 05:46:08 -07:00
|
|
|
if _DevicesSize < 0 {
|
2015-08-17 23:41:34 -07:00
|
|
|
return xdr.ElementSizeExceeded("Devices", _DevicesSize, 1000000)
|
2016-02-02 04:44:33 -07:00
|
|
|
} else if _DevicesSize == 0 {
|
|
|
|
o.Devices = nil
|
|
|
|
} else {
|
|
|
|
if _DevicesSize > 1000000 {
|
|
|
|
return xdr.ElementSizeExceeded("Devices", _DevicesSize, 1000000)
|
|
|
|
}
|
|
|
|
if _DevicesSize <= len(o.Devices) {
|
|
|
|
o.Devices = o.Devices[:_DevicesSize]
|
|
|
|
} else {
|
|
|
|
o.Devices = make([]Device, _DevicesSize)
|
|
|
|
}
|
|
|
|
for i := range o.Devices {
|
|
|
|
(&o.Devices[i]).UnmarshalXDRFrom(u)
|
|
|
|
}
|
2015-08-17 23:41:34 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
o.Flags = u.UnmarshalUint32()
|
|
|
|
_OptionsSize := int(u.UnmarshalUint32())
|
2015-04-08 05:46:08 -07:00
|
|
|
if _OptionsSize < 0 {
|
|
|
|
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
2016-02-02 04:44:33 -07:00
|
|
|
} else if _OptionsSize == 0 {
|
|
|
|
o.Options = nil
|
|
|
|
} else {
|
|
|
|
if _OptionsSize > 64 {
|
|
|
|
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
|
|
|
}
|
|
|
|
if _OptionsSize <= len(o.Options) {
|
|
|
|
o.Options = o.Options[:_OptionsSize]
|
|
|
|
} else {
|
|
|
|
o.Options = make([]Option, _OptionsSize)
|
|
|
|
}
|
|
|
|
for i := range o.Options {
|
|
|
|
(&o.Options[i]).UnmarshalXDRFrom(u)
|
|
|
|
}
|
2015-04-08 05:46:08 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return u.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
Device Structure:
|
2014-09-22 12:42:11 -07: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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ ID (length + padded data) \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2015-09-27 03:39:02 -07:00
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Name (length + padded data) \
|
2015-09-27 03:39:02 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Addresses |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
/ /
|
|
|
|
\ Addresses (length + padded data) \
|
|
|
|
/ /
|
2015-09-27 03:39:02 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Compression |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Cert Name (length + padded data) \
|
2015-09-27 03:39:02 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-22 12:42:11 -07:00
|
|
|
| |
|
|
|
|
+ Max Local Version (64 bits) +
|
|
|
|
| |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2015-03-25 13:20:04 -07:00
|
|
|
| Flags |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Options |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Zero or more Option Structures \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-22 12:42:11 -07:00
|
|
|
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
struct Device {
|
2014-09-22 12:42:11 -07:00
|
|
|
opaque ID<32>;
|
2015-09-27 03:39:02 -07:00
|
|
|
string Name<64>;
|
|
|
|
string Addresses<64>;
|
|
|
|
unsigned int Compression;
|
|
|
|
string CertName<64>;
|
2015-01-17 17:26:52 -07:00
|
|
|
hyper MaxLocalVersion;
|
2015-03-25 13:20:04 -07:00
|
|
|
unsigned int Flags;
|
|
|
|
Option Options<64>;
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o Device) XDRSize() int {
|
|
|
|
return 4 + len(o.ID) + xdr.Padding(len(o.ID)) +
|
|
|
|
4 + len(o.Name) + xdr.Padding(len(o.Name)) +
|
|
|
|
4 + xdr.SizeOfSlice(o.Addresses) + 4 +
|
|
|
|
4 + len(o.CertName) + xdr.Padding(len(o.CertName)) + 8 + 4 +
|
|
|
|
4 + xdr.SizeOfSlice(o.Options)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Device) MarshalXDR() ([]byte, error) {
|
2016-02-02 04:44:33 -07:00
|
|
|
buf := make([]byte, o.XDRSize())
|
|
|
|
m := &xdr.Marshaller{Data: buf}
|
|
|
|
return buf, o.MarshalXDRInto(m)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Device) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o Device) MarshalXDRInto(m *xdr.Marshaller) error {
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.ID); l > 32 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("ID", l, 32)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalBytes(o.ID)
|
2015-09-27 03:39:02 -07:00
|
|
|
if l := len(o.Name); l > 64 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Name", l, 64)
|
2015-09-27 03:39:02 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalString(o.Name)
|
2015-09-27 03:39:02 -07:00
|
|
|
if l := len(o.Addresses); l > 64 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Addresses", l, 64)
|
2015-09-27 03:39:02 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(uint32(len(o.Addresses)))
|
2015-09-27 03:39:02 -07:00
|
|
|
for i := range o.Addresses {
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalString(o.Addresses[i])
|
2015-09-27 03:39:02 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(o.Compression)
|
2015-09-27 03:39:02 -07:00
|
|
|
if l := len(o.CertName); l > 64 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("CertName", l, 64)
|
2015-09-27 03:39:02 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalString(o.CertName)
|
|
|
|
m.MarshalUint64(uint64(o.MaxLocalVersion))
|
|
|
|
m.MarshalUint32(o.Flags)
|
2015-03-25 13:20:04 -07:00
|
|
|
if l := len(o.Options); l > 64 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Options", l, 64)
|
2015-03-25 13:20:04 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalUint32(uint32(len(o.Options)))
|
2015-03-25 13:20:04 -07:00
|
|
|
for i := range o.Options {
|
2016-02-02 04:44:33 -07:00
|
|
|
if err := o.Options[i].MarshalXDRInto(m); err != nil {
|
|
|
|
return err
|
2015-03-25 13:20:04 -07:00
|
|
|
}
|
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return m.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
func (o *Device) UnmarshalXDR(bs []byte) error {
|
2016-02-02 04:44:33 -07:00
|
|
|
u := &xdr.Unmarshaller{Data: bs}
|
|
|
|
return o.UnmarshalXDRFrom(u)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o *Device) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
o.ID = u.UnmarshalBytesMax(32)
|
|
|
|
o.Name = u.UnmarshalStringMax(64)
|
|
|
|
_AddressesSize := int(u.UnmarshalUint32())
|
2015-09-27 03:39:02 -07:00
|
|
|
if _AddressesSize < 0 {
|
|
|
|
return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
|
2016-02-02 04:44:33 -07:00
|
|
|
} else if _AddressesSize == 0 {
|
|
|
|
o.Addresses = nil
|
|
|
|
} else {
|
|
|
|
if _AddressesSize > 64 {
|
|
|
|
return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
|
|
|
|
}
|
|
|
|
if _AddressesSize <= len(o.Addresses) {
|
|
|
|
for i := _AddressesSize; i < len(o.Addresses); i++ {
|
|
|
|
o.Addresses[i] = ""
|
|
|
|
}
|
|
|
|
o.Addresses = o.Addresses[:_AddressesSize]
|
|
|
|
} else {
|
|
|
|
o.Addresses = make([]string, _AddressesSize)
|
|
|
|
}
|
|
|
|
for i := range o.Addresses {
|
|
|
|
o.Addresses[i] = u.UnmarshalStringMax(2083)
|
|
|
|
}
|
2015-09-27 03:39:02 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
o.Compression = u.UnmarshalUint32()
|
|
|
|
o.CertName = u.UnmarshalStringMax(64)
|
|
|
|
o.MaxLocalVersion = int64(u.UnmarshalUint64())
|
|
|
|
o.Flags = u.UnmarshalUint32()
|
|
|
|
_OptionsSize := int(u.UnmarshalUint32())
|
2015-04-08 05:46:08 -07:00
|
|
|
if _OptionsSize < 0 {
|
|
|
|
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
2016-02-02 04:44:33 -07:00
|
|
|
} else if _OptionsSize == 0 {
|
|
|
|
o.Options = nil
|
|
|
|
} else {
|
|
|
|
if _OptionsSize > 64 {
|
|
|
|
return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
|
|
|
|
}
|
|
|
|
if _OptionsSize <= len(o.Options) {
|
|
|
|
o.Options = o.Options[:_OptionsSize]
|
|
|
|
} else {
|
|
|
|
o.Options = make([]Option, _OptionsSize)
|
|
|
|
}
|
|
|
|
for i := range o.Options {
|
|
|
|
(&o.Options[i]).UnmarshalXDRFrom(u)
|
|
|
|
}
|
2015-04-08 05:46:08 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
return u.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Key (length + padded data) \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Value (length + padded data) \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct Option {
|
|
|
|
string Key<64>;
|
|
|
|
string Value<1024>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o Option) XDRSize() int {
|
|
|
|
return 4 + len(o.Key) + xdr.Padding(len(o.Key)) +
|
|
|
|
4 + len(o.Value) + xdr.Padding(len(o.Value))
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Option) MarshalXDR() ([]byte, error) {
|
2016-02-02 04:44:33 -07:00
|
|
|
buf := make([]byte, o.XDRSize())
|
|
|
|
m := &xdr.Marshaller{Data: buf}
|
|
|
|
return buf, o.MarshalXDRInto(m)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Option) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o Option) MarshalXDRInto(m *xdr.Marshaller) error {
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.Key); l > 64 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Key", l, 64)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalString(o.Key)
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.Value); l > 1024 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Value", l, 1024)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalString(o.Value)
|
|
|
|
return m.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *Option) UnmarshalXDR(bs []byte) error {
|
2016-02-02 04:44:33 -07:00
|
|
|
u := &xdr.Unmarshaller{Data: bs}
|
|
|
|
return o.UnmarshalXDRFrom(u)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o *Option) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
o.Key = u.UnmarshalStringMax(64)
|
|
|
|
o.Value = u.UnmarshalStringMax(1024)
|
|
|
|
return u.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2016-02-02 04:44:33 -07:00
|
|
|
\ Reason (length + padded data) \
|
2014-09-22 12:42:11 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2015-01-08 02:28:39 -07:00
|
|
|
| Code |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-22 12:42:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
struct CloseMessage {
|
|
|
|
string Reason<1024>;
|
2015-01-17 17:26:52 -07:00
|
|
|
int Code;
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o CloseMessage) XDRSize() int {
|
|
|
|
return 4 + len(o.Reason) + xdr.Padding(len(o.Reason)) + 4
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o CloseMessage) MarshalXDR() ([]byte, error) {
|
2016-02-02 04:44:33 -07:00
|
|
|
buf := make([]byte, o.XDRSize())
|
|
|
|
m := &xdr.Marshaller{Data: buf}
|
|
|
|
return buf, o.MarshalXDRInto(m)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o CloseMessage) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o CloseMessage) MarshalXDRInto(m *xdr.Marshaller) error {
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.Reason); l > 1024 {
|
2016-02-02 04:44:33 -07:00
|
|
|
return xdr.ElementSizeExceeded("Reason", l, 1024)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
m.MarshalString(o.Reason)
|
|
|
|
m.MarshalUint32(uint32(o.Code))
|
|
|
|
return m.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *CloseMessage) UnmarshalXDR(bs []byte) error {
|
2016-02-02 04:44:33 -07:00
|
|
|
u := &xdr.Unmarshaller{Data: bs}
|
|
|
|
return o.UnmarshalXDRFrom(u)
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o *CloseMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
o.Reason = u.UnmarshalStringMax(1024)
|
|
|
|
o.Code = int32(u.UnmarshalUint32())
|
|
|
|
return u.Error
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
EmptyMessage Structure:
|
2015-11-24 12:54:49 -07:00
|
|
|
(contains no fields)
|
2014-09-22 12:42:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
struct EmptyMessage {
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o EmptyMessage) XDRSize() int {
|
|
|
|
return 0
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o EmptyMessage) MarshalXDR() ([]byte, error) {
|
2015-11-24 12:54:49 -07:00
|
|
|
return nil, nil
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o EmptyMessage) MustMarshalXDR() []byte {
|
2015-11-24 12:54:49 -07:00
|
|
|
return nil
|
2014-10-20 23:40:05 -07:00
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o EmptyMessage) MarshalXDRInto(m *xdr.Marshaller) error {
|
2015-11-24 12:54:49 -07:00
|
|
|
return nil
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *EmptyMessage) UnmarshalXDR(bs []byte) error {
|
2015-11-24 12:54:49 -07:00
|
|
|
return nil
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|
|
|
|
|
2016-02-02 04:44:33 -07:00
|
|
|
func (o *EmptyMessage) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
|
|
|
|
return nil
|
2014-09-22 12:42:11 -07:00
|
|
|
}
|