Documentation
¶
Overview ¶
Package rfb defines representations and serialization for messages in the RFB (Remote Framebuffer) protocol, which is used for VNC.
Types that do not not have a protocol version suffix such as "RFB33" are appropriate for use with all known versions of the RFB protocol.
See the RFCs for details, but the initial handshake goes like this:
server sends ProtocolVersionMessage client sends ProtocolVersionMessage server sends AuthenticationSchemeMessageRFB33 If AuthenticationSchemeNone: continue If AuthenticationSchemeVNC: server sends VNCAuthenticationChallengeMessage client sends VNCAuthenticationResponseMessage server sends VNCAuthenticationResultMessage client sends ClientInitialisationMessage server sends ServerInitialisationMessage
Thereafter, client and server enter message processing loops. The first byte identifies the message type, which dictates the length of the payload, so all clients and servers must process all event types. Each message's Read function verifies the presence of the message type byte.
Clients may send:
Type 0 SetPixelFormatMessage Type 1 FixColourMapEntries — uncommon, not implemented by this library Type 2 SetEncodingsMessage Type 3 FramebufferUpdateRequestMessage Type 4 KeyEventMessage Type 5 PointerEventMessage Type 6 ClientCutTextMessage
Servers may send:
Type 0 FramebufferUpdateMessage — only in response to FramebufferUpdateRequestMessage Type 1 SetColourMapEntries — uncommon, not implemented by this library Type 2 BellMessage Type 3 ServerCutTextMessage
Index ¶
- Constants
- type AuthenticationScheme
- type AuthenticationSchemeMessageRFB33
- type BellMessage
- type ClientCutTextMessage
- type ClientInitialisationMessage
- type FramebufferUpdateMessage
- type FramebufferUpdateRect
- type FramebufferUpdateRequestMessage
- type KeyEventMessage
- type PixelFormat
- type PixelFormatColor
- type PixelFormatImage
- func (img *PixelFormatImage) At(x, y int) color.Color
- func (img *PixelFormatImage) Bounds() image.Rectangle
- func (img *PixelFormatImage) ColorModel() color.Model
- func (dst *PixelFormatImage) CopyFromRGBA(src *image.RGBA) error
- func (src *PixelFormatImage) CopyToRGBA(dst *image.RGBA) error
- func (img *PixelFormatImage) Set(x, y int, c color.Color)
- type PointerEventMessage
- type ProtocolVersionMessage
- type ServerCutTextMessage
- type ServerInitialisationMessage
- type SetEncodingsMessage
- type SetPixelFormatMessage
- type VNCAuthenticationChallengeMessage
- type VNCAuthenticationResponseMessage
- type VNCAuthenticationResult
- type VNCAuthenticationResultMessage
Constants ¶
const ( AuthenticationSchemeInvalid = AuthenticationScheme(0) AuthenticationSchemeNone = AuthenticationScheme(1) AuthenticationSchemeVNC = AuthenticationScheme(2) )
const ( VNCAuthenticationResultOK = VNCAuthenticationResult(0) VNCAuthenticationResultFailed = VNCAuthenticationResult(1) VNCAuthenticationResultTooMany = VNCAuthenticationResult(2) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationScheme ¶
type AuthenticationScheme uint32
type AuthenticationSchemeMessageRFB33 ¶
type AuthenticationSchemeMessageRFB33 struct {
Scheme AuthenticationScheme
}
type BellMessage ¶
type BellMessage struct{}
type ClientCutTextMessage ¶
type ClientCutTextMessage struct {
Text string
}
type ClientInitialisationMessage ¶
type ClientInitialisationMessage struct { // If false, disconnect all other clients. Shared bool }
type FramebufferUpdateMessage ¶
type FramebufferUpdateMessage struct {
Rectangles []*FramebufferUpdateRect
}
func (*FramebufferUpdateMessage) Read ¶
func (m *FramebufferUpdateMessage) Read(r io.Reader, bo binary.ByteOrder, pixelFormat PixelFormat) error
type FramebufferUpdateRect ¶
type FramebufferUpdateRect struct { X uint16 Y uint16 Width uint16 Height uint16 EncodingType uint32 // Unsigned per spec, but often interpreted signed PixelData []byte }
func (*FramebufferUpdateRect) Read ¶
func (rect *FramebufferUpdateRect) Read(r io.Reader, bo binary.ByteOrder, pixelFormat PixelFormat) error
type FramebufferUpdateRequestMessage ¶
type FramebufferUpdateRequestMessage struct { // If true, only updates to changed portions of the framebuffer are requested. // If false, the entire region should be returned and EncodingTypeCopyRectangle is not supported. Incremental bool X uint16 Y uint16 Width uint16 Height uint16 }
type KeyEventMessage ¶
type KeyEventMessage struct { Pressed bool KeySym uint32 // Defined in Xlib Reference Manual and <X11/keysymdef.h> }
type PixelFormat ¶
type PixelFormat struct { BitsPerPixel uint8 BitDepth uint8 BigEndian bool // RGB definitions below are used if true. // If false, palette mode is used, which is unsupported by this library. TrueColor bool RedMax uint16 GreenMax uint16 BlueMax uint16 RedShift uint8 GreenShift uint8 BlueShift uint8 }
type PixelFormatColor ¶
type PixelFormatColor struct { Pixel uint32 PixelFormat PixelFormat }
PixelFormatColor represents a color using the wire format specified by PixelFormat.
func (PixelFormatColor) RGBA ¶
func (c PixelFormatColor) RGBA() (r, g, b, a uint32)
type PixelFormatImage ¶
type PixelFormatImage struct { Pix []uint8 Rect image.Rectangle PixelFormat PixelFormat // contains filtered or unexported fields }
PixelFormatImage represents an image using the wire format specified by PixelFormat. Supports arbitrary drawing with At and Set, but for speed, use CopyToRGBA and CopyFromRGBA.
func NewPixelFormatImage ¶
func NewPixelFormatImage(pixelFormat PixelFormat, bounds image.Rectangle) (*PixelFormatImage, error)
func (*PixelFormatImage) Bounds ¶
func (img *PixelFormatImage) Bounds() image.Rectangle
func (*PixelFormatImage) ColorModel ¶
func (img *PixelFormatImage) ColorModel() color.Model
func (*PixelFormatImage) CopyFromRGBA ¶
func (dst *PixelFormatImage) CopyFromRGBA(src *image.RGBA) error
CopyFromRGBA copies src into dst, returning an error if their bounds are not exactly equal. The alpha channel is ignored.
func (*PixelFormatImage) CopyToRGBA ¶
func (src *PixelFormatImage) CopyToRGBA(dst *image.RGBA) error
type PointerEventMessage ¶
type ProtocolVersionMessage ¶
type ProtocolVersionMessage struct {
Major, Minor int
}
type ServerCutTextMessage ¶
type ServerCutTextMessage struct {
Text string
}
type ServerInitialisationMessage ¶
type ServerInitialisationMessage struct { FramebufferWidth uint16 FramebufferHeight uint16 PixelFormat PixelFormat Name string }
type SetEncodingsMessage ¶
type SetEncodingsMessage struct {
EncodingTypes []uint32
}
type SetPixelFormatMessage ¶
type SetPixelFormatMessage struct {
PixelFormat PixelFormat
}
type VNCAuthenticationChallengeMessage ¶
type VNCAuthenticationChallengeMessage [16]byte
type VNCAuthenticationResponseMessage ¶
type VNCAuthenticationResponseMessage [16]byte
type VNCAuthenticationResult ¶
type VNCAuthenticationResult uint32
type VNCAuthenticationResultMessage ¶
type VNCAuthenticationResultMessage struct {
Result VNCAuthenticationResult
}