2014-07-13 00:24:25 -07:00
|
|
|
// ************************************************************
|
|
|
|
// This file is automatically generated by genxdr. Do not edit.
|
|
|
|
// ************************************************************
|
|
|
|
|
2014-02-20 09:40:15 -07:00
|
|
|
package discover
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"io"
|
|
|
|
|
2014-08-01 04:12:54 -07:00
|
|
|
"github.com/calmh/xdr"
|
2014-02-20 09:40:15 -07:00
|
|
|
)
|
|
|
|
|
2014-07-13 00:24:25 -07:00
|
|
|
/*
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
Query Structure:
|
2014-07-13 00:24:25 -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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Magic |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-28 04:00:38 -07:00
|
|
|
| Length of Device ID |
|
2014-07-13 00:24:25 -07:00
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2014-09-28 04:00:38 -07:00
|
|
|
\ Device ID (variable length) \
|
2014-07-13 00:24:25 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
struct Query {
|
2014-07-13 00:24:25 -07:00
|
|
|
unsigned int Magic;
|
2014-09-28 04:00:38 -07:00
|
|
|
opaque DeviceID<32>;
|
2014-07-13 00:24:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
func (o Query) EncodeXDR(w io.Writer) (int, error) {
|
2014-02-20 09:40:15 -07:00
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Query) MarshalXDR() ([]byte, error) {
|
2014-07-06 10:21:37 -07:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Query) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o Query) AppendXDR(bs []byte) ([]byte, error) {
|
2014-07-06 10:21:37 -07:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
2014-06-30 04:33:52 -07:00
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-20 23:40:05 -07:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
func (o Query) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-02-20 09:40:15 -07:00
|
|
|
xw.WriteUint32(o.Magic)
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.DeviceID); l > 32 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("DeviceID", l, 32)
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
2014-09-28 04:00:38 -07:00
|
|
|
xw.WriteBytes(o.DeviceID)
|
2014-02-20 09:40:15 -07:00
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
func (o *Query) DecodeXDR(r io.Reader) error {
|
2014-02-20 09:40:15 -07:00
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
func (o *Query) UnmarshalXDR(bs []byte) error {
|
2014-06-30 04:33:52 -07:00
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
2014-02-20 09:40:15 -07:00
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
func (o *Query) decodeXDR(xr *xdr.Reader) error {
|
2014-02-20 09:40:15 -07:00
|
|
|
o.Magic = xr.ReadUint32()
|
2014-09-28 04:00:38 -07:00
|
|
|
o.DeviceID = xr.ReadBytesMax(32)
|
2014-02-20 09:40:15 -07:00
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
2014-07-13 00:24:25 -07:00
|
|
|
/*
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
Announce Structure:
|
2014-07-13 00:24:25 -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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Magic |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
2014-09-28 04:00:38 -07:00
|
|
|
| Device |
|
2014-07-13 00:24:25 -07:00
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Extra |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
2014-09-28 04:00:38 -07:00
|
|
|
\ Zero or more Device Structures \
|
2014-07-13 00:24:25 -07:00
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
struct Announce {
|
2014-07-13 00:24:25 -07:00
|
|
|
unsigned int Magic;
|
2014-09-28 04:00:38 -07:00
|
|
|
Device This;
|
|
|
|
Device Extra<16>;
|
2014-07-13 00:24:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
func (o Announce) EncodeXDR(w io.Writer) (int, error) {
|
2014-02-20 09:40:15 -07:00
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Announce) MarshalXDR() ([]byte, error) {
|
2014-07-06 10:21:37 -07:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Announce) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o Announce) AppendXDR(bs []byte) ([]byte, error) {
|
2014-07-06 10:21:37 -07:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
2014-06-30 04:33:52 -07:00
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-20 23:40:05 -07:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
func (o Announce) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-02-20 09:40:15 -07:00
|
|
|
xw.WriteUint32(o.Magic)
|
2014-07-31 06:21:33 -07:00
|
|
|
_, err := o.This.encodeXDR(xw)
|
|
|
|
if err != nil {
|
|
|
|
return xw.Tot(), err
|
|
|
|
}
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.Extra); l > 16 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Extra", l, 16)
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
2014-05-11 15:55:43 -07:00
|
|
|
xw.WriteUint32(uint32(len(o.Extra)))
|
|
|
|
for i := range o.Extra {
|
2014-07-31 06:21:33 -07:00
|
|
|
_, err := o.Extra[i].encodeXDR(xw)
|
|
|
|
if err != nil {
|
|
|
|
return xw.Tot(), err
|
|
|
|
}
|
2014-05-11 15:55:43 -07:00
|
|
|
}
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
func (o *Announce) DecodeXDR(r io.Reader) error {
|
2014-05-11 15:55:43 -07:00
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
func (o *Announce) UnmarshalXDR(bs []byte) error {
|
2014-06-30 04:33:52 -07:00
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
2014-05-11 15:55:43 -07:00
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
2014-07-13 00:33:44 -07:00
|
|
|
func (o *Announce) decodeXDR(xr *xdr.Reader) error {
|
2014-05-11 15:55:43 -07:00
|
|
|
o.Magic = xr.ReadUint32()
|
|
|
|
(&o.This).decodeXDR(xr)
|
|
|
|
_ExtraSize := int(xr.ReadUint32())
|
|
|
|
if _ExtraSize > 16 {
|
2014-10-20 23:40:05 -07:00
|
|
|
return xdr.ElementSizeExceeded("Extra", _ExtraSize, 16)
|
2014-05-11 15:55:43 -07:00
|
|
|
}
|
2014-09-28 04:00:38 -07:00
|
|
|
o.Extra = make([]Device, _ExtraSize)
|
2014-05-11 15:55:43 -07:00
|
|
|
for i := range o.Extra {
|
|
|
|
(&o.Extra[i]).decodeXDR(xr)
|
|
|
|
}
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
2014-07-13 00:24:25 -07:00
|
|
|
/*
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
Device Structure:
|
2014-07-13 00:24:25 -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
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of ID |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ ID (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Number of Addresses |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ Zero or more Address Structures \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
struct Device {
|
2014-07-13 00:24:25 -07:00
|
|
|
opaque ID<32>;
|
|
|
|
Address Addresses<16>;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
func (o Device) EncodeXDR(w io.Writer) (int, error) {
|
2014-05-11 15:55:43 -07:00
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Device) MarshalXDR() ([]byte, error) {
|
2014-07-06 10:21:37 -07:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Device) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o Device) AppendXDR(bs []byte) ([]byte, error) {
|
2014-07-06 10:21:37 -07:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
2014-06-30 04:33:52 -07:00
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-20 23:40:05 -07:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-05-11 15:55:43 -07:00
|
|
|
}
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
func (o Device) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.ID); l > 32 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("ID", l, 32)
|
2014-05-11 15:55:43 -07:00
|
|
|
}
|
2014-06-29 16:42:03 -07:00
|
|
|
xw.WriteBytes(o.ID)
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.Addresses); l > 16 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("Addresses", l, 16)
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
|
|
|
xw.WriteUint32(uint32(len(o.Addresses)))
|
|
|
|
for i := range o.Addresses {
|
2014-07-31 06:21:33 -07:00
|
|
|
_, err := o.Addresses[i].encodeXDR(xw)
|
|
|
|
if err != nil {
|
|
|
|
return xw.Tot(), err
|
|
|
|
}
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
func (o *Device) DecodeXDR(r io.Reader) error {
|
2014-02-20 09:40:15 -07:00
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
func (o *Device) UnmarshalXDR(bs []byte) error {
|
2014-06-30 04:33:52 -07:00
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
2014-02-20 09:40:15 -07:00
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
2014-09-28 04:00:38 -07:00
|
|
|
func (o *Device) decodeXDR(xr *xdr.Reader) error {
|
2014-06-29 16:42:03 -07:00
|
|
|
o.ID = xr.ReadBytesMax(32)
|
2014-02-20 09:40:15 -07:00
|
|
|
_AddressesSize := int(xr.ReadUint32())
|
|
|
|
if _AddressesSize > 16 {
|
2014-10-20 23:40:05 -07:00
|
|
|
return xdr.ElementSizeExceeded("Addresses", _AddressesSize, 16)
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
|
|
|
o.Addresses = make([]Address, _AddressesSize)
|
|
|
|
for i := range o.Addresses {
|
|
|
|
(&o.Addresses[i]).decodeXDR(xr)
|
|
|
|
}
|
|
|
|
return xr.Error()
|
|
|
|
}
|
|
|
|
|
2014-07-13 00:24:25 -07:00
|
|
|
/*
|
|
|
|
|
|
|
|
Address Structure:
|
|
|
|
|
|
|
|
0 1 2 3
|
|
|
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| Length of IP |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
/ /
|
|
|
|
\ IP (variable length) \
|
|
|
|
/ /
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
| 0x0000 | Port |
|
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
|
|
|
|
|
|
|
|
struct Address {
|
|
|
|
opaque IP<16>;
|
|
|
|
unsigned int Port;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-02-20 09:40:15 -07:00
|
|
|
func (o Address) EncodeXDR(w io.Writer) (int, error) {
|
|
|
|
var xw = xdr.NewWriter(w)
|
|
|
|
return o.encodeXDR(xw)
|
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Address) MarshalXDR() ([]byte, error) {
|
2014-07-06 10:21:37 -07:00
|
|
|
return o.AppendXDR(make([]byte, 0, 128))
|
|
|
|
}
|
|
|
|
|
2014-10-20 23:40:05 -07:00
|
|
|
func (o Address) MustMarshalXDR() []byte {
|
|
|
|
bs, err := o.MarshalXDR()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return bs
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o Address) AppendXDR(bs []byte) ([]byte, error) {
|
2014-07-06 10:21:37 -07:00
|
|
|
var aw = xdr.AppendWriter(bs)
|
2014-06-30 04:33:52 -07:00
|
|
|
var xw = xdr.NewWriter(&aw)
|
2014-10-20 23:40:05 -07:00
|
|
|
_, err := o.encodeXDR(xw)
|
|
|
|
return []byte(aw), err
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o Address) encodeXDR(xw *xdr.Writer) (int, error) {
|
2014-10-20 23:40:05 -07:00
|
|
|
if l := len(o.IP); l > 16 {
|
|
|
|
return xw.Tot(), xdr.ElementSizeExceeded("IP", l, 16)
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
|
|
|
xw.WriteBytes(o.IP)
|
|
|
|
xw.WriteUint16(o.Port)
|
|
|
|
return xw.Tot(), xw.Error()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *Address) DecodeXDR(r io.Reader) error {
|
|
|
|
xr := xdr.NewReader(r)
|
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *Address) UnmarshalXDR(bs []byte) error {
|
2014-06-30 04:33:52 -07:00
|
|
|
var br = bytes.NewReader(bs)
|
|
|
|
var xr = xdr.NewReader(br)
|
2014-02-20 09:40:15 -07:00
|
|
|
return o.decodeXDR(xr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *Address) decodeXDR(xr *xdr.Reader) error {
|
|
|
|
o.IP = xr.ReadBytesMax(16)
|
|
|
|
o.Port = xr.ReadUint16()
|
|
|
|
return xr.Error()
|
|
|
|
}
|