red

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CapabilityAuthSelection uint32 = 0
	CapabilityAuthSpice     uint32 = 1
	CapabilityAuthSASL      uint32 = 2
	CapabilityMiniHeader    uint32 = 3
)

Common capabilities

View Source
const (
	CapabilityMainSemiSeamlessMigrate  uint32 = 0
	CapabilityMainNameAndUUID          uint32 = 1
	CapabilityMainAgentConnectedTokens uint32 = 2
	CapabilityMainSeamlessMigrate      uint32 = 3
)

Main Channel capabilities

View Source
const (
	CapabilityPlaybackCELT051 uint32 = 0
	CapabilityPlaybackVolume  uint32 = 1
	CapabilityPlaybackLatency uint32 = 2
	CapabilityPlaybackOpus    uint32 = 3
)

Playback Channel capabilities

View Source
const (
	CapabilityRecordCELT051 uint32 = 0
	CapabilityRecordVolume  uint32 = 1
	CapabilityRecordOpus    uint32 = 2
)

Record Channel capabilities

View Source
const (
	CapabilityDisplaySizedStream     uint32 = 0
	CapabilityDisplayMonitorsConfig  uint32 = 1
	CapabilityDisplayComposite       uint32 = 2
	CapabilityDisplayA8Surface       uint32 = 3
	CapabilityDisplayStreamReport    uint32 = 4
	CapabilityDisplayLZ4Compression  uint32 = 5
	CapabilityDisplayPREFCompression uint32 = 6
	CapabilityDisplayGLScanout       uint32 = 7
	CapabilityDisplayMMultiCodec     uint32 = 8
	CapabilityDisplayCodecMJPEG      uint32 = 9
	CapabilityDisplayCodecVP8        uint32 = 10
	CapabilityDisplayCodecH264       uint32 = 11
)

Display Channel capabilities

View Source
const (
	// VersionMajor is the major version of the supported protocol
	VersionMajor uint32 = 2
	// VersionMinor is the minor version of the supported protocol
	VersionMinor uint32 = 2
)
View Source
const (
	CapabilityInputKeyScancode uint32 = 0
)

Input Channel capabilities

View Source
const ClientTicketBytes = 128

ClientTicketBytes is the length of an encrypted Spice token

View Source
const TicketPubkeyBytes = 162

TicketPubkeyBytes is the length of a ticket RSA public key

Variables

View Source
var Magic = [4]uint8{0x52, 0x45, 0x44, 0x51}

Magic is the spice RED protocol magic bytes

Functions

This section is empty.

Types

type AuthMethod

type AuthMethod uint32

AuthMethod is the method used for authentication

const (
	// AuthMethodSpice is the spice token based authentication method
	AuthMethodSpice AuthMethod = 1
	// AuthMethodSASL is the SASL authentication method
	AuthMethodSASL AuthMethod = 2
)

func (AuthMethod) String

func (i AuthMethod) String() string

type Capability

type Capability uint32

Capability is a bitwise capability set

func (*Capability) Clear

func (c *Capability) Clear(i uint32) *Capability

Clear bit i to 0

func (*Capability) Flip

func (c *Capability) Flip(i uint32) *Capability

Flip bit at i

func (*Capability) Set

func (c *Capability) Set(i uint32) *Capability

Set bit i to 1

func (*Capability) SetTo

func (c *Capability) SetTo(i uint32, value bool) *Capability

SetTo sets bit i to value

func (*Capability) Test

func (c *Capability) Test(i uint32) bool

Test whether bit i is set.

type ChannelType

type ChannelType uint8

ChannelType is the packet channel type

const (
	ChannelMain      ChannelType = 1
	ChannelDisplay   ChannelType = 2
	ChannelInputs    ChannelType = 3
	ChannelCursor    ChannelType = 4
	ChannelPlayback  ChannelType = 5
	ChannelRecord    ChannelType = 6
	ChannelTunnel    ChannelType = 7
	ChannelSmartcard ChannelType = 8
	ChannelUSBRedir  ChannelType = 9
	ChannelPort      ChannelType = 10
	ChannelWebdav    ChannelType = 11
)

Channel types

func (ChannelType) String

func (i ChannelType) String() string

type ClientAuthMethod

type ClientAuthMethod struct {
	// Method is the authentication method selected by the client
	Method AuthMethod
}

ClientAuthMethod is a spice packet send by the client to select the authentication method.

func (*ClientAuthMethod) MarshalBinary

func (p *ClientAuthMethod) MarshalBinary() ([]byte, error)

MarshalBinary marshals an Packet into a byte slice.

func (*ClientAuthMethod) UnmarshalBinary

func (p *ClientAuthMethod) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals the contents of a byte slice into a Packet.

type ClientLinkMessage

type ClientLinkMessage struct {
	// SessionID In   case   of   a   new   session   (i.e.,   channel   type   is
	// ChannelMain) this field is set to zero, and in response the server will
	// allocate session id and will send it via the RedLinkReply message. In case of all other
	// channel types, this field will be equal to the allocated session id.
	SessionID uint32

	// ChannelType is one of RED_CHANNEL_?
	ChannelType ChannelType

	// ChannelID to connect to. This enables having multiple channels of the same type
	ChannelID uint8

	// CommonCaps is the number of common client channel capabilities words
	CommonCaps uint32

	// ChannelCaps is the number of specific client channel capabilities words
	ChannelCaps uint32

	// CapsOffset is the location of the start of the capabilities vector given by the
	// bytes offset from the “ size” member (i.e., from the address of the “connection_id”
	// member).
	CapsOffset uint32

	// Capabilities hold the variable length capabilities
	CommonCapabilities  []Capability
	ChannelCapabilities []Capability
}

ClientLinkMessage is a spice packet send by the client to start a connection.

func (*ClientLinkMessage) MarshalBinary

func (p *ClientLinkMessage) MarshalBinary() ([]byte, error)

MarshalBinary marshals a Packet into a byte slice.

func (*ClientLinkMessage) UnmarshalBinary

func (p *ClientLinkMessage) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals the contents of a byte slice into a Packet.

type ClientTicket

type ClientTicket struct {
	// Ticket is the RSA encrypted ticket
	Ticket [ClientTicketBytes]byte
}

ClientTicket is a spice packet send by the client that contains a ticket

func (*ClientTicket) MarshalBinary

func (p *ClientTicket) MarshalBinary() ([]byte, error)

MarshalBinary marshals a Packet into a byte slice.

func (*ClientTicket) UnmarshalBinary

func (p *ClientTicket) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals the contents of a byte slice into a Packet.

type ErrorCode

type ErrorCode uint32

ErrorCode return on error

const (
	ErrorOk                  ErrorCode = 0
	ErrorError               ErrorCode = 1
	ErrorInvalidMagic        ErrorCode = 2
	ErrorInvalidData         ErrorCode = 3
	ErrorVersionMismatch     ErrorCode = 4
	ErrorNeedSecured         ErrorCode = 5
	ErrorNeedUnsecured       ErrorCode = 6
	ErrorPermissionDenied    ErrorCode = 7
	ErrorBadConnectionID     ErrorCode = 8
	ErrorChannelNotAvailable ErrorCode = 9
)

Error codes

func (ErrorCode) String

func (i ErrorCode) String() string

type LinkHeader

type LinkHeader struct {
	// Magic must be equal to Magic
	Magic [4]uint8

	// Major must be equal to RED_VERSION_MAJOR
	Major uint32

	// Minor must be equal to RED_VERSION_MINOR
	Minor uint32

	// Size in bytes following this field to the end of this message
	Size uint32
}

LinkHeader is a header to a client link message packet

func (*LinkHeader) MarshalBinary

func (p *LinkHeader) MarshalBinary() ([]byte, error)

MarshalBinary marshals a Packet into a byte slice.

func (*LinkHeader) UnmarshalBinary

func (p *LinkHeader) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals the contents of a byte slice into a Packet.

type MiniDataHeader

type MiniDataHeader struct {
	// MessageType is type of message
	MessageType uint16

	// Size in bytes following this field to the end of this message
	Size uint32
}

MiniDataHeader is a header to a data packet

func (*MiniDataHeader) MarshalBinary

func (p *MiniDataHeader) MarshalBinary() ([]byte, error)

MarshalBinary marshals an Packet into a byte slice.

func (*MiniDataHeader) UnmarshalBinary

func (p *MiniDataHeader) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals the contents of a byte slice into a Packet.

type PubKey

type PubKey [TicketPubkeyBytes]byte

PubKey is a red ticket public key

type ServerLinkMessage

type ServerLinkMessage struct {
	// Error codes (i.e., RED_ERROR_?)
	Error ErrorCode

	// PubKey is a 1024 bit RSA public key in X.509 SubjectPublicKeyInfo format
	PubKey [TicketPubkeyBytes]uint8

	// CommonCaps is the number of common client channel capabilities words
	CommonCaps uint32

	// ChannelCaps is the number of specific client channel capabilities words
	ChannelCaps uint32

	// CapsOffset is the location of the start of the capabilities vector given by the
	// bytes offset from the “ size” member (i.e., from the address of the “connection_id”
	// member).
	CapsOffset uint32

	// Capabilities hold the variable length capabilities
	CommonCapabilities  []Capability
	ChannelCapabilities []Capability
}

ServerLinkMessage is a spice packet send by the server in response to a ClientLinkMessage

func (*ServerLinkMessage) MarshalBinary

func (p *ServerLinkMessage) MarshalBinary() ([]byte, error)

MarshalBinary marshals a Packet into a byte slice.

func (*ServerLinkMessage) UnmarshalBinary

func (p *ServerLinkMessage) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals the contents of a byte slice into a Packet.

type ServerTicket

type ServerTicket struct {
	Result ErrorCode
}

ServerTicket is a spice packet send by the server in response to a ClientTicket packet

func (*ServerTicket) MarshalBinary

func (p *ServerTicket) MarshalBinary() ([]byte, error)

MarshalBinary marshals a Packet into a byte slice.

func (*ServerTicket) UnmarshalBinary

func (p *ServerTicket) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals the contents of a byte slice into a Packet.

type SpicePacket

type SpicePacket interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	// contains filtered or unexported methods
}

SpicePacket is the interface used for passing around different kinds of packets.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL