예제 #1
0
func (o JoinSessionRequest) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.Key); l > 32 {
		return xw.Tot(), xdr.ElementSizeExceeded("Key", l, 32)
	}
	xw.WriteBytes(o.Key)
	return xw.Tot(), xw.Error()
}
예제 #2
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()
}
예제 #3
0
func (o IndexMessage) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	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()
}
예제 #4
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()
}
예제 #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)
	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()
}
예제 #6
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()
}
예제 #7
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()
}
예제 #8
0
func (o addressList) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(uint32(len(o.addresses)))
	for i := range o.addresses {
		o.addresses[i].encodeXDR(xw)
	}
	return xw.Tot(), xw.Error()
}
예제 #9
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()
}
예제 #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()
}
예제 #11
0
func (o Query) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Magic)
	if l := len(o.DeviceID); l > 32 {
		return xw.Tot(), xdr.ElementSizeExceeded("DeviceID", l, 32)
	}
	xw.WriteBytes(o.DeviceID)
	return xw.Tot(), xw.Error()
}
예제 #12
0
func (o Address) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.IP); l > 16 {
		return xw.Tot(), xdr.ElementSizeExceeded("IP", l, 16)
	}
	xw.WriteBytes(o.IP)
	xw.WriteUint16(o.Port)
	return xw.Tot(), xw.Error()
}
예제 #13
0
func (o fileVersion) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	_, err := o.version.EncodeXDRInto(xw)
	if err != nil {
		return xw.Tot(), err
	}
	xw.WriteBytes(o.device)
	return xw.Tot(), xw.Error()
}
예제 #14
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()
}
예제 #15
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()
}
예제 #16
0
func (o BlockInfo) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(uint32(o.Size))
	if l := len(o.Hash); l > 64 {
		return xw.Tot(), xdr.ElementSizeExceeded("Hash", l, 64)
	}
	xw.WriteBytes(o.Hash)
	return xw.Tot(), xw.Error()
}
예제 #17
0
func (o BlockInfo) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Size)
	if len(o.Hash) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteBytes(o.Hash)
	return xw.Tot(), xw.Error()
}
예제 #18
0
func (o Query) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Magic)
	if len(o.DeviceID) > 32 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteBytes(o.DeviceID)
	return xw.Tot(), xw.Error()
}
예제 #19
0
func (o Address) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.IP) > 16 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteBytes(o.IP)
	xw.WriteUint16(o.Port)
	return xw.Tot(), xw.Error()
}
예제 #20
0
func (o Device) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.ID) > 32 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteBytes(o.ID)
	xw.WriteUint32(o.Flags)
	xw.WriteUint64(o.MaxLocalVersion)
	return xw.Tot(), xw.Error()
}
예제 #21
0
func (o versionList) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(uint32(len(o.versions)))
	for i := range o.versions {
		_, err := o.versions[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
예제 #22
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()
}
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()
}
예제 #24
0
func (o Folder) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.ID) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ID)
	if len(o.Devices) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	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()
}
예제 #25
0
func (o SessionInvitation) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	if l := len(o.From); l > 32 {
		return xw.Tot(), xdr.ElementSizeExceeded("From", l, 32)
	}
	xw.WriteBytes(o.From)
	if l := len(o.Key); l > 32 {
		return xw.Tot(), xdr.ElementSizeExceeded("Key", l, 32)
	}
	xw.WriteBytes(o.Key)
	if l := len(o.Address); l > 32 {
		return xw.Tot(), xdr.ElementSizeExceeded("Address", l, 32)
	}
	xw.WriteBytes(o.Address)
	xw.WriteUint16(o.Port)
	xw.WriteBool(o.ServerSocket)
	return xw.Tot(), xw.Error()
}
예제 #26
0
func (o Device) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.ID) > 32 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteBytes(o.ID)
	if len(o.Addresses) > 16 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Addresses)))
	for i := range o.Addresses {
		_, err := o.Addresses[i].encodeXDR(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
예제 #27
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
		}
	}
	return xw.Tot(), xw.Error()
}
예제 #28
0
func (o Announce) EncodeXDRInto(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Magic)
	_, err := o.This.EncodeXDRInto(xw)
	if err != nil {
		return xw.Tot(), err
	}
	if l := len(o.Extra); l > 16 {
		return xw.Tot(), xdr.ElementSizeExceeded("Extra", l, 16)
	}
	xw.WriteUint32(uint32(len(o.Extra)))
	for i := range o.Extra {
		_, err := o.Extra[i].EncodeXDRInto(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
예제 #29
0
func (o Announce) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Magic)
	_, err := o.This.encodeXDR(xw)
	if err != nil {
		return xw.Tot(), err
	}
	if len(o.Extra) > 16 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Extra)))
	for i := range o.Extra {
		_, err := o.Extra[i].encodeXDR(xw)
		if err != nil {
			return xw.Tot(), err
		}
	}
	return xw.Tot(), xw.Error()
}
예제 #30
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()
}