Example #1
0
func (o *Device) DecodeXDRFrom(xr *xdr.Reader) error {
	o.ID = xr.ReadBytesMax(32)
	o.Name = xr.ReadStringMax(64)
	_AddressesSize := int(xr.ReadUint32())
	if _AddressesSize < 0 {
		return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
	}
	if _AddressesSize > 64 {
		return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
	}
	o.Addresses = make([]string, _AddressesSize)
	for i := range o.Addresses {
		o.Addresses[i] = xr.ReadStringMax(2083)
	}
	o.Compression = xr.ReadUint32()
	o.CertName = xr.ReadStringMax(64)
	o.MaxLocalVersion = int64(xr.ReadUint64())
	o.Flags = xr.ReadUint32()
	_OptionsSize := int(xr.ReadUint32())
	if _OptionsSize < 0 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	}
	if _OptionsSize > 64 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	}
	o.Options = make([]Option, _OptionsSize)
	for i := range o.Options {
		(&o.Options[i]).DecodeXDRFrom(xr)
	}
	return xr.Error()
}
Example #2
0
func (o *Folder) DecodeXDRFrom(xr *xdr.Reader) error {
	o.ID = xr.ReadStringMax(64)
	_DevicesSize := int(xr.ReadUint32())
	if _DevicesSize < 0 {
		return xdr.ElementSizeExceeded("Devices", _DevicesSize, 1000000)
	}
	if _DevicesSize > 1000000 {
		return xdr.ElementSizeExceeded("Devices", _DevicesSize, 1000000)
	}
	o.Devices = make([]Device, _DevicesSize)
	for i := range o.Devices {
		(&o.Devices[i]).DecodeXDRFrom(xr)
	}
	o.Flags = xr.ReadUint32()
	_OptionsSize := int(xr.ReadUint32())
	if _OptionsSize < 0 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	}
	if _OptionsSize > 64 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	}
	o.Options = make([]Option, _OptionsSize)
	for i := range o.Options {
		(&o.Options[i]).DecodeXDRFrom(xr)
	}
	return xr.Error()
}
Example #3
0
func (o IndexMessage) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.Folder); l > 256 {
		return xw.Tot(), xdr.ElementSizeExceeded("Folder", l, 256)
	}
	xw.WriteString(o.Folder)
	if l := len(o.Files); l > 1000000 {
		return xw.Tot(), xdr.ElementSizeExceeded("Files", l, 1000000)
	}
	xw.WriteUint32(uint32(len(o.Files)))
	for i := range o.Files {
		_, err := o.Files[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	xw.WriteUint32(o.Flags)
	if l := len(o.Options); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
	}
	xw.WriteUint32(uint32(len(o.Options)))
	for i := range o.Options {
		_, err := o.Options[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
Example #4
0
func (o Device) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.ID); l > 32 {
		return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 32)
	}
	xw.WriteBytes(o.ID)
	if l := len(o.Addresses); l > 16 {
		return xw.Tot(), xdr.ElementSizeExceeded("Addresses", l, 16)
	}
	xw.WriteUint32(uint32(len(o.Addresses)))
	for i := range o.Addresses {
		_, err := o.Addresses[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	if l := len(o.Relays); l > 16 {
		return xw.Tot(), xdr.ElementSizeExceeded("Relays", l, 16)
	}
	xw.WriteUint32(uint32(len(o.Relays)))
	for i := range o.Relays {
		_, err := o.Relays[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
Example #5
0
func (o Folder) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.ID); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 64)
	}
	xw.WriteString(o.ID)
	if l := len(o.Devices); l > 1000000 {
		return xw.Tot(), xdr.ElementSizeExceeded("Devices", l, 1000000)
	}
	xw.WriteUint32(uint32(len(o.Devices)))
	for i := range o.Devices {
		_, err := o.Devices[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	xw.WriteUint32(o.Flags)
	if l := len(o.Options); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
	}
	xw.WriteUint32(uint32(len(o.Options)))
	for i := range o.Options {
		_, err := o.Options[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
Example #6
0
func (o Device) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.ID); l > 32 {
		return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 32)
	}
	xw.WriteBytes(o.ID)
	if l := len(o.Name); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 64)
	}
	xw.WriteString(o.Name)
	if l := len(o.Addresses); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Addresses", l, 64)
	}
	xw.WriteUint32(uint32(len(o.Addresses)))
	for i := range o.Addresses {
		xw.WriteString(o.Addresses[i])
	}
	xw.WriteUint32(o.Compression)
	if l := len(o.CertName); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("CertName", l, 64)
	}
	xw.WriteString(o.CertName)
	xw.WriteUint64(uint64(o.MaxLocalVersion))
	xw.WriteUint32(o.Flags)
	if l := len(o.Options); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
	}
	xw.WriteUint32(uint32(len(o.Options)))
	for i := range o.Options {
		_, err := o.Options[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
Example #7
0
func (o RequestMessage) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.Folder); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Folder", l, 64)
	}
	xw.WriteString(o.Folder)
	if l := len(o.Name); l > 8192 {
		return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
	}
	xw.WriteString(o.Name)
	xw.WriteUint64(uint64(o.Offset))
	xw.WriteUint32(uint32(o.Size))
	if l := len(o.Hash); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Hash", l, 64)
	}
	xw.WriteBytes(o.Hash)
	xw.WriteUint32(o.Flags)
	if l := len(o.Options); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
	}
	xw.WriteUint32(uint32(len(o.Options)))
	for i := range o.Options {
		_, err := o.Options[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
Example #8
0
func (o Folder) MarshalXDRInto(m *xdr.Marshaller) error {
	if l := len(o.ID); l > 256 {
		return xdr.ElementSizeExceeded("ID", l, 256)
	}
	m.MarshalString(o.ID)
	if l := len(o.Label); l > 256 {
		return xdr.ElementSizeExceeded("Label", l, 256)
	}
	m.MarshalString(o.Label)
	if l := len(o.Devices); l > 1000000 {
		return xdr.ElementSizeExceeded("Devices", l, 1000000)
	}
	m.MarshalUint32(uint32(len(o.Devices)))
	for i := range o.Devices {
		if err := o.Devices[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	m.MarshalUint32(o.Flags)
	if l := len(o.Options); l > 64 {
		return xdr.ElementSizeExceeded("Options", l, 64)
	}
	m.MarshalUint32(uint32(len(o.Options)))
	for i := range o.Options {
		if err := o.Options[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	return m.Error
}
Example #9
0
func (o *IndexMessage) DecodeXDRFrom(xr *xdr.Reader) error {
	o.Folder = xr.ReadString()
	_FilesSize := int(xr.ReadUint32())
	if _FilesSize < 0 {
		return xdr.ElementSizeExceeded("Files", _FilesSize, 1000000)
	}
	if _FilesSize > 1000000 {
		return xdr.ElementSizeExceeded("Files", _FilesSize, 1000000)
	}
	o.Files = make([]FileInfo, _FilesSize)
	for i := range o.Files {
		(&o.Files[i]).DecodeXDRFrom(xr)
	}
	o.Flags = xr.ReadUint32()
	_OptionsSize := int(xr.ReadUint32())
	if _OptionsSize < 0 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	}
	if _OptionsSize > 64 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	}
	o.Options = make([]Option, _OptionsSize)
	for i := range o.Options {
		(&o.Options[i]).DecodeXDRFrom(xr)
	}
	return xr.Error()
}
Example #10
0
func (o FileInfo) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.Name); l > 8192 {
		return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
	}
	xw.WriteString(o.Name)
	xw.WriteUint32(o.Flags)
	xw.WriteUint64(uint64(o.Modified))
	_, err := o.Version.EncodeXDRInto(xw)
	if err != nil {
		return xw.Tot(), err
	}
	xw.WriteUint64(uint64(o.LocalVersion))
	if l := len(o.Blocks); l > 1000000 {
		return xw.Tot(), xdr.ElementSizeExceeded("Blocks", l, 1000000)
	}
	xw.WriteUint32(uint32(len(o.Blocks)))
	for i := range o.Blocks {
		_, err := o.Blocks[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	xw.WriteUint32(uint32(o.UID))
	xw.WriteUint32(uint32(o.GID))
	return xw.Tot(), xw.Error()
}
Example #11
0
func (o Device) MarshalXDRInto(m *xdr.Marshaller) error {
	if l := len(o.ID); l > 32 {
		return xdr.ElementSizeExceeded("ID", l, 32)
	}
	m.MarshalBytes(o.ID)
	if l := len(o.Addresses); l > 16 {
		return xdr.ElementSizeExceeded("Addresses", l, 16)
	}
	m.MarshalUint32(uint32(len(o.Addresses)))
	for i := range o.Addresses {
		if err := o.Addresses[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	if l := len(o.Relays); l > 16 {
		return xdr.ElementSizeExceeded("Relays", l, 16)
	}
	m.MarshalUint32(uint32(len(o.Relays)))
	for i := range o.Relays {
		if err := o.Relays[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	return m.Error
}
Example #12
0
func (o ClusterConfigMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if l := len(o.ClientName); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("ClientName", l, 64)
	}
	xw.WriteString(o.ClientName)
	if l := len(o.ClientVersion); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("ClientVersion", l, 64)
	}
	xw.WriteString(o.ClientVersion)
	if l := len(o.Folders); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Folders", l, 64)
	}
	xw.WriteUint32(uint32(len(o.Folders)))
	for i := range o.Folders {
		_, err := o.Folders[i].encodeXDR(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	if l := len(o.Options); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Options", l, 64)
	}
	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()
}
Example #13
0
func (o *Device) DecodeXDRFrom(xr *xdr.Reader) error {
	o.ID = xr.ReadBytesMax(32)
	_AddressesSize := int(xr.ReadUint32())
	if _AddressesSize < 0 {
		return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 16)
	}
	if _AddressesSize > 16 {
		return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 16)
	}
	o.Addresses = make([]string, _AddressesSize)
	for i := range o.Addresses {
		o.Addresses[i] = xr.ReadString()
	}
	_RelaysSize := int(xr.ReadUint32())
	if _RelaysSize < 0 {
		return xdr.ElementSizeExceeded("Relays", _RelaysSize, 16)
	}
	if _RelaysSize > 16 {
		return xdr.ElementSizeExceeded("Relays", _RelaysSize, 16)
	}
	o.Relays = make([]Relay, _RelaysSize)
	for i := range o.Relays {
		(&o.Relays[i]).DecodeXDRFrom(xr)
	}
	return xr.Error()
}
Example #14
0
func (o *TestStruct) DecodeXDRFrom(xr *xdr.Reader) error {
	o.I = int(xr.ReadUint64())
	o.I8 = int8(xr.ReadUint8())
	o.UI8 = xr.ReadUint8()
	o.I16 = int16(xr.ReadUint16())
	o.UI16 = xr.ReadUint16()
	o.I32 = int32(xr.ReadUint32())
	o.UI32 = xr.ReadUint32()
	o.I64 = int64(xr.ReadUint64())
	o.UI64 = xr.ReadUint64()
	o.BS = xr.ReadBytesMax(1024)
	o.S = xr.ReadStringMax(1024)
	(&o.C).DecodeXDRFrom(xr)
	_SSSize := int(xr.ReadUint32())
	if _SSSize < 0 {
		return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
	}
	if _SSSize > 1024 {
		return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
	}
	o.SS = make([]string, _SSSize)
	for i := range o.SS {
		o.SS[i] = xr.ReadString()
	}
	return xr.Error()
}
Example #15
0
func (o TestStruct) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	xw.WriteUint64(uint64(o.I))
	xw.WriteUint8(uint8(o.I8))
	xw.WriteUint8(o.UI8)
	xw.WriteUint16(uint16(o.I16))
	xw.WriteUint16(o.UI16)
	xw.WriteUint32(uint32(o.I32))
	xw.WriteUint32(o.UI32)
	xw.WriteUint64(uint64(o.I64))
	xw.WriteUint64(o.UI64)
	if l := len(o.BS); l > 1024 {
		return xw.Tot(), xdr.ElementSizeExceeded("BS", l, 1024)
	}
	xw.WriteBytes(o.BS)
	if l := len(o.S); l > 1024 {
		return xw.Tot(), xdr.ElementSizeExceeded("S", l, 1024)
	}
	xw.WriteString(o.S)
	_, err := o.C.EncodeXDRInto(xw)
	if err != nil {
		return xw.Tot(), err
	}
	if l := len(o.SS); l > 1024 {
		return xw.Tot(), xdr.ElementSizeExceeded("SS", l, 1024)
	}
	xw.WriteUint32(uint32(len(o.SS)))
	for i := range o.SS {
		xw.WriteString(o.SS[i])
	}
	return xw.Tot(), xw.Error()
}
Example #16
0
func (o Device) MarshalXDRInto(m *xdr.Marshaller) error {
	if l := len(o.ID); l > 32 {
		return xdr.ElementSizeExceeded("ID", l, 32)
	}
	m.MarshalBytes(o.ID)
	if l := len(o.Name); l > 64 {
		return xdr.ElementSizeExceeded("Name", l, 64)
	}
	m.MarshalString(o.Name)
	if l := len(o.Addresses); l > 64 {
		return xdr.ElementSizeExceeded("Addresses", l, 64)
	}
	m.MarshalUint32(uint32(len(o.Addresses)))
	for i := range o.Addresses {
		m.MarshalString(o.Addresses[i])
	}
	m.MarshalUint32(o.Compression)
	if l := len(o.CertName); l > 64 {
		return xdr.ElementSizeExceeded("CertName", l, 64)
	}
	m.MarshalString(o.CertName)
	m.MarshalUint64(uint64(o.MaxLocalVersion))
	m.MarshalUint32(o.Flags)
	if l := len(o.Options); l > 64 {
		return xdr.ElementSizeExceeded("Options", l, 64)
	}
	m.MarshalUint32(uint32(len(o.Options)))
	for i := range o.Options {
		if err := o.Options[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	return m.Error
}
Example #17
0
func (o *ClusterConfigMessage) DecodeXDRFrom(xr *xdr.Reader) error {
	o.ClientName = xr.ReadStringMax(64)
	o.ClientVersion = xr.ReadStringMax(64)
	_FoldersSize := int(xr.ReadUint32())
	if _FoldersSize < 0 {
		return xdr.ElementSizeExceeded("Folders", _FoldersSize, 1000000)
	}
	if _FoldersSize > 1000000 {
		return xdr.ElementSizeExceeded("Folders", _FoldersSize, 1000000)
	}
	o.Folders = make([]Folder, _FoldersSize)
	for i := range o.Folders {
		(&o.Folders[i]).DecodeXDRFrom(xr)
	}
	_OptionsSize := int(xr.ReadUint32())
	if _OptionsSize < 0 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	}
	if _OptionsSize > 64 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	}
	o.Options = make([]Option, _OptionsSize)
	for i := range o.Options {
		(&o.Options[i]).DecodeXDRFrom(xr)
	}
	return xr.Error()
}
Example #18
0
func (o DownloadProgressMessage) MarshalXDRInto(m *xdr.Marshaller) error {
	if l := len(o.Folder); l > 64 {
		return xdr.ElementSizeExceeded("Folder", l, 64)
	}
	m.MarshalString(o.Folder)
	if l := len(o.Updates); l > 1000000 {
		return xdr.ElementSizeExceeded("Updates", l, 1000000)
	}
	m.MarshalUint32(uint32(len(o.Updates)))
	for i := range o.Updates {
		if err := o.Updates[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	m.MarshalUint32(o.Flags)
	if l := len(o.Options); l > 64 {
		return xdr.ElementSizeExceeded("Options", l, 64)
	}
	m.MarshalUint32(uint32(len(o.Options)))
	for i := range o.Options {
		if err := o.Options[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	return m.Error
}
Example #19
0
func (o ClusterConfigMessage) 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)
	if l := len(o.Folders); l > 1000000 {
		return xdr.ElementSizeExceeded("Folders", l, 1000000)
	}
	m.MarshalUint32(uint32(len(o.Folders)))
	for i := range o.Folders {
		if err := o.Folders[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	if l := len(o.Options); l > 64 {
		return xdr.ElementSizeExceeded("Options", l, 64)
	}
	m.MarshalUint32(uint32(len(o.Options)))
	for i := range o.Options {
		if err := o.Options[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	return m.Error
}
Example #20
0
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())
	if _OptionsSize < 0 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	} 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)
		}
	}
	return u.Error
}
Example #21
0
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())
	if _BlocksSize < 0 {
		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
	} else if _BlocksSize == 0 {
		o.Blocks = nil
	} else {
		if _BlocksSize > 10000000 {
			return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
		}
		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)
		}
	}
	return u.Error
}
Example #22
0
func (o RequestMessage) MarshalXDRInto(m *xdr.Marshaller) error {
	if l := len(o.Folder); l > 256 {
		return xdr.ElementSizeExceeded("Folder", l, 256)
	}
	m.MarshalString(o.Folder)
	if l := len(o.Name); l > 8192 {
		return xdr.ElementSizeExceeded("Name", l, 8192)
	}
	m.MarshalString(o.Name)
	m.MarshalUint64(uint64(o.Offset))
	m.MarshalUint32(uint32(o.Size))
	if l := len(o.Hash); l > 64 {
		return xdr.ElementSizeExceeded("Hash", l, 64)
	}
	m.MarshalBytes(o.Hash)
	m.MarshalUint32(o.Flags)
	if l := len(o.Options); l > 64 {
		return xdr.ElementSizeExceeded("Options", l, 64)
	}
	m.MarshalUint32(uint32(len(o.Options)))
	for i := range o.Options {
		if err := o.Options[i].MarshalXDRInto(m); err != nil {
			return err
		}
	}
	return m.Error
}
Example #23
0
func (o Option) MarshalXDRInto(m *xdr.Marshaller) error {
	if l := len(o.Key); l > 64 {
		return xdr.ElementSizeExceeded("Key", l, 64)
	}
	m.MarshalString(o.Key)
	if l := len(o.Value); l > 1024 {
		return xdr.ElementSizeExceeded("Value", l, 1024)
	}
	m.MarshalString(o.Value)
	return m.Error
}
Example #24
0
func (o *TestStruct) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.B = u.UnmarshalBool()
	o.I = int(u.UnmarshalUint64())
	o.I8 = int8(u.UnmarshalUint8())
	o.UI8 = u.UnmarshalUint8()
	o.I16 = int16(u.UnmarshalUint16())
	o.UI16 = u.UnmarshalUint16()
	o.I32 = int32(u.UnmarshalUint32())
	o.UI32 = u.UnmarshalUint32()
	o.I64 = int64(u.UnmarshalUint64())
	o.UI64 = u.UnmarshalUint64()
	o.BS = u.UnmarshalBytesMax(1024)
	o.S = u.UnmarshalStringMax(1024)
	(&o.C).UnmarshalXDRFrom(u)
	_SSSize := int(u.UnmarshalUint32())
	if _SSSize < 0 {
		return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
	} else if _SSSize == 0 {
		o.SS = nil
	} else {
		if _SSSize > 1024 {
			return xdr.ElementSizeExceeded("SS", _SSSize, 1024)
		}
		if _SSSize <= len(o.SS) {
			for i := _SSSize; i < len(o.SS); i++ {
				o.SS[i] = ""
			}
			o.SS = o.SS[:_SSSize]
		} else {
			o.SS = make([]string, _SSSize)
		}
		for i := range o.SS {
			o.SS[i] = u.UnmarshalString()
		}
	}
	(&o.ES).UnmarshalXDRFrom(u)
	(&o.OS).UnmarshalXDRFrom(u)
	_OSsSize := int(u.UnmarshalUint32())
	if _OSsSize < 0 {
		return xdr.ElementSizeExceeded("OSs", _OSsSize, 0)
	} else if _OSsSize == 0 {
		o.OSs = nil
	} else {
		if _OSsSize <= len(o.OSs) {
			o.OSs = o.OSs[:_OSsSize]
		} else {
			o.OSs = make([]OtherStruct, _OSsSize)
		}
		for i := range o.OSs {
			(&o.OSs[i]).UnmarshalXDRFrom(u)
		}
	}
	return u.Error
}
Example #25
0
func (o Option) encodeXDR(xw *xdr.Writer) (int, error) {
	if l := len(o.Key); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Key", l, 64)
	}
	xw.WriteString(o.Key)
	if l := len(o.Value); l > 1024 {
		return xw.Tot(), xdr.ElementSizeExceeded("Value", l, 1024)
	}
	xw.WriteString(o.Value)
	return xw.Tot(), xw.Error()
}
Example #26
0
func (o RequestMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if l := len(o.Folder); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Folder", l, 64)
	}
	xw.WriteString(o.Folder)
	if l := len(o.Name); l > 8192 {
		return xw.Tot(), xdr.ElementSizeExceeded("Name", l, 8192)
	}
	xw.WriteString(o.Name)
	xw.WriteUint64(o.Offset)
	xw.WriteUint32(o.Size)
	return xw.Tot(), xw.Error()
}
Example #27
0
func (o Version13HelloMessage) 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
}
Example #28
0
func (o *Device) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
	o.ID = u.UnmarshalBytesMax(32)
	o.Name = u.UnmarshalStringMax(64)
	_AddressesSize := int(u.UnmarshalUint32())
	if _AddressesSize < 0 {
		return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 64)
	} 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)
		}
	}
	o.Compression = u.UnmarshalUint32()
	o.CertName = u.UnmarshalStringMax(64)
	o.MaxLocalVersion = int64(u.UnmarshalUint64())
	o.Flags = u.UnmarshalUint32()
	_OptionsSize := int(u.UnmarshalUint32())
	if _OptionsSize < 0 {
		return xdr.ElementSizeExceeded("Options", _OptionsSize, 64)
	} 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)
		}
	}
	return u.Error
}
Example #29
0
func (o CloseMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if l := len(o.Reason); l > 1024 {
		return xw.Tot(), xdr.ElementSizeExceeded("Reason", l, 1024)
	}
	xw.WriteString(o.Reason)
	return xw.Tot(), xw.Error()
}
Example #30
0
func (o ConnectRequest) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.ID); l > 32 {
		return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 32)
	}
	xw.WriteBytes(o.ID)
	return xw.Tot(), xw.Error()
}