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 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 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.
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 FramebufferUpdate 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
- type PointerEventMessage
- type ProtocolVersionMessage
- type ServerCutTextMessage
- type ServerInitialisationMessage
- type SetEncodingsMessage
- type SetPixelFormatMessage
- type VNCAuthenticationChallengeMessage
- type VNCAuthenticationResponseMessage
- type VNCAuthenticationResult
- type VNCAuthenticationResultMessage
Constants ¶
View Source
const ( AuthenticationSchemeInvalid = AuthenticationScheme(0) AuthenticationSchemeNone = AuthenticationScheme(1) AuthenticationSchemeVNC = AuthenticationScheme(2) )
View Source
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 TrueColor bool RedMax uint16 GreenMax uint16 BlueMax uint16 RedShift uint8 GreenShift uint8 BlueShift uint8 }
type PixelFormatColor ¶
type PixelFormatColor struct { Pixel uint32 PixelFormat 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 }
func NewPixelFormatImage ¶
func NewPixelFormatImage(pixelFormat PixelFormat, bounds image.Rectangle) *PixelFormatImage
func (*PixelFormatImage) Bounds ¶
func (img *PixelFormatImage) Bounds() image.Rectangle
func (*PixelFormatImage) ColorModel ¶
func (img *PixelFormatImage) ColorModel() color.Model
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
}
Click to show internal directories.
Click to hide internal directories.