syncthing/lib/relay/protocol/packets_xdr.go

473 lines
11 KiB
Go
Raw Normal View History

2015-06-24 11:39:46 +00:00
// ************************************************************
// This file is automatically generated by genxdr. Do not edit.
// ************************************************************
package protocol
import (
"github.com/calmh/xdr"
)
/*
2015-06-28 00:52:01 +00:00
header Structure:
2015-06-24 11:39:46 +00: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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2015-06-28 00:52:01 +00:00
| magic |
2015-06-24 11:39:46 +00:00
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2015-06-28 00:52:01 +00:00
| message Type |
2015-06-24 11:39:46 +00:00
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2015-06-28 00:52:01 +00:00
| message Length |
2015-06-24 11:39:46 +00:00
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2015-06-28 00:52:01 +00:00
struct header {
unsigned int magic;
int messageType;
int messageLength;
2015-06-24 11:39:46 +00:00
}
*/
func (header) XDRSize() int {
2016-02-02 11:44:33 +00:00
return 4 + 4 + 4
2015-06-24 11:39:46 +00:00
}
2015-06-28 00:52:01 +00:00
func (o header) MarshalXDR() ([]byte, error) {
2016-02-02 11:44:33 +00:00
buf := make([]byte, o.XDRSize())
m := &xdr.Marshaller{Data: buf}
return buf, o.MarshalXDRInto(m)
2015-06-24 11:39:46 +00:00
}
2015-06-28 00:52:01 +00:00
func (o header) MustMarshalXDR() []byte {
2015-06-24 11:39:46 +00:00
bs, err := o.MarshalXDR()
if err != nil {
panic(err)
}
return bs
}
2016-02-02 11:44:33 +00:00
func (o header) MarshalXDRInto(m *xdr.Marshaller) error {
m.MarshalUint32(o.magic)
m.MarshalUint32(uint32(o.messageType))
m.MarshalUint32(uint32(o.messageLength))
return m.Error
2015-06-24 11:39:46 +00:00
}
2015-06-28 00:52:01 +00:00
func (o *header) UnmarshalXDR(bs []byte) error {
2016-02-02 11:44:33 +00:00
u := &xdr.Unmarshaller{Data: bs}
return o.UnmarshalXDRFrom(u)
2015-06-24 11:39:46 +00:00
}
2016-02-02 11:44:33 +00:00
func (o *header) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.magic = u.UnmarshalUint32()
o.messageType = int32(u.UnmarshalUint32())
o.messageLength = int32(u.UnmarshalUint32())
return u.Error
2015-06-24 11:39:46 +00:00
}
/*
Ping Structure:
2015-11-24 19:54:49 +00:00
(contains no fields)
2015-06-24 11:39:46 +00:00
struct Ping {
}
*/
func (Ping) XDRSize() int {
2016-02-02 11:44:33 +00:00
return 0
2015-06-24 11:39:46 +00:00
}
func (Ping) MarshalXDR() ([]byte, error) {
2015-11-24 19:54:49 +00:00
return nil, nil
2015-06-24 11:39:46 +00:00
}
func (Ping) MustMarshalXDR() []byte {
2015-11-24 19:54:49 +00:00
return nil
2015-06-24 11:39:46 +00:00
}
func (Ping) MarshalXDRInto(_ *xdr.Marshaller) error {
2015-11-24 19:54:49 +00:00
return nil
2015-06-24 11:39:46 +00:00
}
func (*Ping) UnmarshalXDR(_ []byte) error {
2015-11-24 19:54:49 +00:00
return nil
2015-06-24 11:39:46 +00:00
}
func (*Ping) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
2016-02-02 11:44:33 +00:00
return nil
2015-06-24 11:39:46 +00:00
}
/*
Pong Structure:
2015-11-24 19:54:49 +00:00
(contains no fields)
2015-06-24 11:39:46 +00:00
struct Pong {
}
*/
func (Pong) XDRSize() int {
2016-02-02 11:44:33 +00:00
return 0
2015-06-24 11:39:46 +00:00
}
func (Pong) MarshalXDR() ([]byte, error) {
2015-11-24 19:54:49 +00:00
return nil, nil
2015-06-24 11:39:46 +00:00
}
func (Pong) MustMarshalXDR() []byte {
2015-11-24 19:54:49 +00:00
return nil
2015-06-24 11:39:46 +00:00
}
func (Pong) MarshalXDRInto(_ *xdr.Marshaller) error {
2015-11-24 19:54:49 +00:00
return nil
2015-06-24 11:39:46 +00:00
}
func (*Pong) UnmarshalXDR(_ []byte) error {
2015-11-24 19:54:49 +00:00
return nil
2015-06-24 11:39:46 +00:00
}
func (*Pong) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
2016-02-02 11:44:33 +00:00
return nil
2015-06-24 11:39:46 +00:00
}
/*
RelayFull Structure:
2015-11-24 19:54:49 +00:00
(contains no fields)
2015-06-24 11:39:46 +00:00
struct RelayFull {
2015-06-24 11:39:46 +00:00
}
*/
func (RelayFull) XDRSize() int {
2016-02-02 11:44:33 +00:00
return 0
2015-06-24 11:39:46 +00:00
}
func (RelayFull) MarshalXDR() ([]byte, error) {
2015-11-24 19:54:49 +00:00
return nil, nil
2015-06-24 11:39:46 +00:00
}
func (RelayFull) MustMarshalXDR() []byte {
2015-11-24 19:54:49 +00:00
return nil
2015-06-24 11:39:46 +00:00
}
func (RelayFull) MarshalXDRInto(_ *xdr.Marshaller) error {
2015-11-24 19:54:49 +00:00
return nil
2015-06-24 11:39:46 +00:00
}
func (*RelayFull) UnmarshalXDR(_ []byte) error {
2015-11-24 19:54:49 +00:00
return nil
2015-06-24 11:39:46 +00:00
}
func (*RelayFull) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
2016-02-02 11:44:33 +00:00
return nil
2015-06-28 00:52:01 +00:00
}
/*
JoinRelayRequest 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ /
\ Token (length + padded data) \
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2015-11-20 23:42:49 +00:00
struct JoinRelayRequest {
string Token<>;
2015-11-20 23:42:49 +00:00
}
*/
func (o JoinRelayRequest) XDRSize() int {
return 4 + len(o.Token) + xdr.Padding(len(o.Token))
2015-11-20 23:42:49 +00:00
}
func (o JoinRelayRequest) MarshalXDR() ([]byte, error) {
buf := make([]byte, o.XDRSize())
m := &xdr.Marshaller{Data: buf}
return buf, o.MarshalXDRInto(m)
2015-11-20 23:42:49 +00:00
}
func (o JoinRelayRequest) MustMarshalXDR() []byte {
bs, err := o.MarshalXDR()
if err != nil {
panic(err)
}
return bs
2015-11-20 23:42:49 +00:00
}
func (o JoinRelayRequest) MarshalXDRInto(m *xdr.Marshaller) error {
m.MarshalString(o.Token)
return m.Error
2015-11-20 23:42:49 +00:00
}
func (o *JoinRelayRequest) UnmarshalXDR(bs []byte) error {
u := &xdr.Unmarshaller{Data: bs}
return o.UnmarshalXDRFrom(u)
}
func (o *JoinRelayRequest) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.Token = u.UnmarshalString()
return u.Error
2015-11-20 23:42:49 +00:00
}
/*
2015-06-28 00:52:01 +00:00
JoinSessionRequest 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 11:44:33 +00:00
\ Key (length + padded data) \
2015-06-28 00:52:01 +00:00
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
struct JoinSessionRequest {
opaque Key<32>;
}
*/
2016-02-02 11:44:33 +00:00
func (o JoinSessionRequest) XDRSize() int {
return 4 + len(o.Key) + xdr.Padding(len(o.Key))
2015-06-28 00:52:01 +00:00
}
func (o JoinSessionRequest) MarshalXDR() ([]byte, error) {
2016-02-02 11:44:33 +00:00
buf := make([]byte, o.XDRSize())
m := &xdr.Marshaller{Data: buf}
return buf, o.MarshalXDRInto(m)
2015-06-28 00:52:01 +00:00
}
func (o JoinSessionRequest) MustMarshalXDR() []byte {
bs, err := o.MarshalXDR()
if err != nil {
panic(err)
}
return bs
}
2016-02-02 11:44:33 +00:00
func (o JoinSessionRequest) MarshalXDRInto(m *xdr.Marshaller) error {
2015-06-28 00:52:01 +00:00
if l := len(o.Key); l > 32 {
2016-02-02 11:44:33 +00:00
return xdr.ElementSizeExceeded("Key", l, 32)
2015-06-28 00:52:01 +00:00
}
2016-02-02 11:44:33 +00:00
m.MarshalBytes(o.Key)
return m.Error
2015-06-28 00:52:01 +00:00
}
func (o *JoinSessionRequest) UnmarshalXDR(bs []byte) error {
2016-02-02 11:44:33 +00:00
u := &xdr.Unmarshaller{Data: bs}
return o.UnmarshalXDRFrom(u)
2015-06-28 00:52:01 +00:00
}
2016-02-02 11:44:33 +00:00
func (o *JoinSessionRequest) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.Key = u.UnmarshalBytesMax(32)
return u.Error
2015-06-28 00:52:01 +00:00
}
/*
Response 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Code |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ /
2016-02-02 11:44:33 +00:00
\ Message (length + padded data) \
2015-06-28 00:52:01 +00:00
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
struct Response {
int Code;
string Message<>;
}
*/
2016-02-02 11:44:33 +00:00
func (o Response) XDRSize() int {
return 4 +
4 + len(o.Message) + xdr.Padding(len(o.Message))
2015-06-28 00:52:01 +00:00
}
func (o Response) MarshalXDR() ([]byte, error) {
2016-02-02 11:44:33 +00:00
buf := make([]byte, o.XDRSize())
m := &xdr.Marshaller{Data: buf}
return buf, o.MarshalXDRInto(m)
2015-06-28 00:52:01 +00:00
}
func (o Response) MustMarshalXDR() []byte {
bs, err := o.MarshalXDR()
if err != nil {
panic(err)
}
return bs
}
2016-02-02 11:44:33 +00:00
func (o Response) MarshalXDRInto(m *xdr.Marshaller) error {
m.MarshalUint32(uint32(o.Code))
m.MarshalString(o.Message)
return m.Error
2015-06-28 00:52:01 +00:00
}
func (o *Response) UnmarshalXDR(bs []byte) error {
2016-02-02 11:44:33 +00:00
u := &xdr.Unmarshaller{Data: bs}
return o.UnmarshalXDRFrom(u)
2015-06-28 00:52:01 +00:00
}
2016-02-02 11:44:33 +00:00
func (o *Response) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.Code = int32(u.UnmarshalUint32())
o.Message = u.UnmarshalString()
return u.Error
2015-06-24 11:39:46 +00:00
}
/*
ConnectRequest 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 11:44:33 +00:00
\ ID (length + padded data) \
2015-06-24 11:39:46 +00:00
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
struct ConnectRequest {
opaque ID<32>;
}
*/
2016-02-02 11:44:33 +00:00
func (o ConnectRequest) XDRSize() int {
return 4 + len(o.ID) + xdr.Padding(len(o.ID))
2015-06-24 11:39:46 +00:00
}
func (o ConnectRequest) MarshalXDR() ([]byte, error) {
2016-02-02 11:44:33 +00:00
buf := make([]byte, o.XDRSize())
m := &xdr.Marshaller{Data: buf}
return buf, o.MarshalXDRInto(m)
2015-06-24 11:39:46 +00:00
}
func (o ConnectRequest) MustMarshalXDR() []byte {
bs, err := o.MarshalXDR()
if err != nil {
panic(err)
}
return bs
}
2016-02-02 11:44:33 +00:00
func (o ConnectRequest) MarshalXDRInto(m *xdr.Marshaller) error {
2015-06-24 11:39:46 +00:00
if l := len(o.ID); l > 32 {
2016-02-02 11:44:33 +00:00
return xdr.ElementSizeExceeded("ID", l, 32)
2015-06-24 11:39:46 +00:00
}
2016-02-02 11:44:33 +00:00
m.MarshalBytes(o.ID)
return m.Error
2015-06-24 11:39:46 +00:00
}
func (o *ConnectRequest) UnmarshalXDR(bs []byte) error {
2016-02-02 11:44:33 +00:00
u := &xdr.Unmarshaller{Data: bs}
return o.UnmarshalXDRFrom(u)
2015-06-24 11:39:46 +00:00
}
2016-02-02 11:44:33 +00:00
func (o *ConnectRequest) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.ID = u.UnmarshalBytesMax(32)
return u.Error
2015-06-24 11:39:46 +00:00
}
/*
SessionInvitation 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2015-06-28 00:52:01 +00:00
/ /
2016-02-02 11:44:33 +00:00
\ From (length + padded data) \
2015-06-28 00:52:01 +00:00
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2015-06-24 11:39:46 +00:00
/ /
2016-02-02 11:44:33 +00:00
\ Key (length + padded data) \
2015-06-24 11:39:46 +00:00
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/ /
2016-02-02 11:44:33 +00:00
\ Address (length + padded data) \
2015-06-24 11:39:46 +00:00
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2016-02-02 11:44:33 +00:00
| 16 zero bits | Port |
2015-06-24 11:39:46 +00:00
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Server Socket (V=0 or 1) |V|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
struct SessionInvitation {
2015-06-28 00:52:01 +00:00
opaque From<32>;
2015-06-24 11:39:46 +00:00
opaque Key<32>;
opaque Address<32>;
unsigned int Port;
bool ServerSocket;
}
*/
2016-02-02 11:44:33 +00:00
func (o SessionInvitation) XDRSize() int {
return 4 + len(o.From) + xdr.Padding(len(o.From)) +
4 + len(o.Key) + xdr.Padding(len(o.Key)) +
4 + len(o.Address) + xdr.Padding(len(o.Address)) + 4 + 4
2015-06-24 11:39:46 +00:00
}
func (o SessionInvitation) MarshalXDR() ([]byte, error) {
2016-02-02 11:44:33 +00:00
buf := make([]byte, o.XDRSize())
m := &xdr.Marshaller{Data: buf}
return buf, o.MarshalXDRInto(m)
2015-06-24 11:39:46 +00:00
}
func (o SessionInvitation) MustMarshalXDR() []byte {
bs, err := o.MarshalXDR()
if err != nil {
panic(err)
}
return bs
}
2016-02-02 11:44:33 +00:00
func (o SessionInvitation) MarshalXDRInto(m *xdr.Marshaller) error {
2015-06-28 00:52:01 +00:00
if l := len(o.From); l > 32 {
2016-02-02 11:44:33 +00:00
return xdr.ElementSizeExceeded("From", l, 32)
2015-06-28 00:52:01 +00:00
}
2016-02-02 11:44:33 +00:00
m.MarshalBytes(o.From)
2015-06-24 11:39:46 +00:00
if l := len(o.Key); l > 32 {
2016-02-02 11:44:33 +00:00
return xdr.ElementSizeExceeded("Key", l, 32)
2015-06-24 11:39:46 +00:00
}
2016-02-02 11:44:33 +00:00
m.MarshalBytes(o.Key)
2015-06-24 11:39:46 +00:00
if l := len(o.Address); l > 32 {
2016-02-02 11:44:33 +00:00
return xdr.ElementSizeExceeded("Address", l, 32)
2015-06-24 11:39:46 +00:00
}
2016-02-02 11:44:33 +00:00
m.MarshalBytes(o.Address)
m.MarshalUint16(o.Port)
m.MarshalBool(o.ServerSocket)
return m.Error
2015-06-24 11:39:46 +00:00
}
func (o *SessionInvitation) UnmarshalXDR(bs []byte) error {
2016-02-02 11:44:33 +00:00
u := &xdr.Unmarshaller{Data: bs}
return o.UnmarshalXDRFrom(u)
}
func (o *SessionInvitation) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
o.From = u.UnmarshalBytesMax(32)
o.Key = u.UnmarshalBytesMax(32)
o.Address = u.UnmarshalBytesMax(32)
o.Port = u.UnmarshalUint16()
o.ServerSocket = u.UnmarshalBool()
return u.Error
2015-06-24 11:39:46 +00:00
}