Exemplo n.º 1
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()
}
Exemplo n.º 2
0
func (o CloseMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.Reason) > 1024 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.Reason)
	return xw.Tot(), xw.Error()
}
Exemplo n.º 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()
}
Exemplo n.º 4
0
func (o Address) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.URL); l > 2083 {
		return xw.Tot(), xdr.ElementSizeExceeded("URL", l, 2083)
	}
	xw.WriteString(o.URL)
	return xw.Tot(), xw.Error()
}
Exemplo n.º 5
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()
}
Exemplo n.º 6
0
func (o ClusterConfigMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.ClientName) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ClientName)
	if len(o.ClientVersion) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ClientVersion)
	if len(o.Folders) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	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 len(o.Options) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	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()
}
Exemplo n.º 7
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()
}
Exemplo n.º 8
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()
}
Exemplo n.º 9
0
func (o ClusterConfigMessage) EncodeXDRInto(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 > 1000000 {
		return xw.Tot(), xdr.ElementSizeExceeded("Folders", l, 1000000)
	}
	xw.WriteUint32(uint32(len(o.Folders)))
	for i := range o.Folders {
		_, err := o.Folders[i].EncodeXDRInto(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].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
Exemplo n.º 10
0
func (o CloseMessage) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.Reason); l > 1024 {
		return xw.Tot(), xdr.ElementSizeExceeded("Reason", l, 1024)
	}
	xw.WriteString(o.Reason)
	xw.WriteUint32(uint32(o.Code))
	return xw.Tot(), xw.Error()
}
Exemplo n.º 11
0
func (o Relay) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.Address); l > 256 {
		return xw.Tot(), xdr.ElementSizeExceeded("Address", l, 256)
	}
	xw.WriteString(o.Address)
	xw.WriteUint32(uint32(o.Latency))
	return xw.Tot(), xw.Error()
}
Exemplo n.º 12
0
func (o Relay) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.URL); l > 2083 {
		return xw.Tot(), xdr.ElementSizeExceeded("URL", l, 2083)
	}
	xw.WriteString(o.URL)
	xw.WriteUint32(uint32(o.Latency))
	return xw.Tot(), xw.Error()
}
Exemplo n.º 13
0
func (o Option) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.Key) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.Key)
	if len(o.Value) > 1024 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.Value)
	return xw.Tot(), xw.Error()
}
Exemplo n.º 14
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()
}
Exemplo n.º 15
0
func (o FileInfoTruncated) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.Name) > 8192 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	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()
}
Exemplo n.º 16
0
func (o RequestMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.Folder) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.Folder)
	if len(o.Name) > 8192 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.Name)
	xw.WriteUint64(o.Offset)
	xw.WriteUint32(o.Size)
	return xw.Tot(), xw.Error()
}
Exemplo n.º 17
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()
}
Exemplo n.º 18
0
func (o Folder) encodeXDR(xw *xdr.Writer) (int, error) {
	if l := len(o.ID); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 64)
	}
	xw.WriteString(o.ID)
	xw.WriteUint32(uint32(len(o.Devices)))
	for i := range o.Devices {
		_, err := o.Devices[i].encodeXDR(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
Exemplo n.º 19
0
func (o IndexMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.Folder) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.Folder)
	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()
}
Exemplo n.º 20
0
func (o XDRBenchStruct) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	xw.WriteUint64(o.I1)
	xw.WriteUint32(o.I2)
	xw.WriteUint16(o.I3)
	xw.WriteUint8(o.I4)
	if l := len(o.Bs0); l > 128 {
		return xw.Tot(), xdr.ElementSizeExceeded("Bs0", l, 128)
	}
	xw.WriteBytes(o.Bs0)
	xw.WriteBytes(o.Bs1)
	if l := len(o.S0); l > 128 {
		return xw.Tot(), xdr.ElementSizeExceeded("S0", l, 128)
	}
	xw.WriteString(o.S0)
	xw.WriteString(o.S1)
	return xw.Tot(), xw.Error()
}
Exemplo n.º 21
0
func (o XDRBenchStruct) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint64(o.I1)
	xw.WriteUint32(o.I2)
	xw.WriteUint16(o.I3)
	xw.WriteUint8(o.I4)
	if len(o.Bs0) > 128 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteBytes(o.Bs0)
	xw.WriteBytes(o.Bs1)
	if len(o.S0) > 128 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.S0)
	xw.WriteString(o.S1)
	return xw.Tot(), xw.Error()
}
Exemplo n.º 22
0
func (o Repository) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.ID) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ID)
	if len(o.Nodes) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Nodes)))
	for i := range o.Nodes {
		_, err := o.Nodes[i].encodeXDR(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
Exemplo n.º 23
0
func (o FileInfo) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.Name) > 8192 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	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 TestStruct) encodeXDR(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)
	xw.WriteBytes(o.BS)
	xw.WriteString(o.S)
	_, err := o.C.encodeXDR(xw)
	if err != nil {
		return xw.Tot(), err
	}
	return xw.Tot(), xw.Error()
}
Exemplo n.º 25
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()
}
Exemplo n.º 26
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 {
		xw.WriteString(o.Addresses[i])
	}
	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()
}
Exemplo n.º 27
0
func (o Response) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(uint32(o.Code))
	xw.WriteString(o.Message)
	return xw.Tot(), xw.Error()
}