syncthing/lib/relay/protocol/packets_xdr.go

456 lines
10 KiB
Go
Raw Normal View History

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