Documentation
¶
Overview ¶
Package disp implements the display control dynamic virtual channel (MS-RDPEDISP), which is how a client asks the server to change the desktop size while a session is running.
Without it a gateway cannot follow a browser window: the desktop size is fixed by the connect sequence, so a user who resizes the page has to reconnect, and reconnecting means authenticating again and losing whatever the session was doing.
Index ¶
- Constants
- type Caps
- type DisplayControlClient
- func (c *DisplayControlClient) GetType() (string, uint32)
- func (c *DisplayControlClient) LastSent() []byte
- func (c *DisplayControlClient) OnCaps(f func(Caps))
- func (c *DisplayControlClient) OnClose()
- func (c *DisplayControlClient) OnData(data []byte)
- func (c *DisplayControlClient) OnOpen(channelID uint32)
- func (c *DisplayControlClient) Process(s []byte)
- func (c *DisplayControlClient) RequestResize(width, height int) error
- func (c *DisplayControlClient) Sender(f core.ChannelSender)
- func (c *DisplayControlClient) SetSender(f func(channelID uint32, data []byte) error)
- type Monitor
Constants ¶
const ( OrientationLandscape = 0 OrientationPortrait = 90 OrientationLandscapeF = 180 OrientationPortraitF = 270 )
Orientation values, in the form the field carries: a rotation from zero, together with the flip bits.
const ChannelName = plugin.DISP_SVC_CHANNEL_NAME
ChannelName is the static virtual channel of the same name. Both are advertised: the messages travel on the dynamic one, but a server that is not offered the static one does not create the dynamic one either.
const ChannelOption = plugin.CHANNEL_OPTION_INITIALIZED | plugin.CHANNEL_OPTION_ENCRYPT_RDP
ChannelOption is what the static channel is advertised with.
const DVCChannelName = "Microsoft::Windows::RDS::DisplayControl"
DVCChannelName is the dynamic virtual channel this package speaks on.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Caps ¶
type Caps struct {
// MaxNumMonitors is the most monitors the server will lay out.
MaxNumMonitors uint32
// MaxMonitorAreaFactorA and B bound the total area the layout may cover.
MaxMonitorAreaFactorA uint32
MaxMonitorAreaFactorB uint32
}
Caps is what the server said it will accept, sent once when the channel opens.
type DisplayControlClient ¶
DisplayControlClient is the channel handler. It is registered with the dynamic virtual channel layer, which calls OnOpen, OnData and OnClose.
func NewDisplayControlClient ¶
func NewDisplayControlClient() *DisplayControlClient
NewDisplayControlClient returns a client for the channel.
func (*DisplayControlClient) GetType ¶ added in v0.8.0
func (c *DisplayControlClient) GetType() (string, uint32)
GetType reports the static channel this handler answers for, which is how the channel layer knows to route to it.
func (*DisplayControlClient) LastSent ¶
func (c *DisplayControlClient) LastSent() []byte
LastSent returns the last layout this client sent, which is what a test compares against. It is a copy.
func (*DisplayControlClient) OnCaps ¶
func (c *DisplayControlClient) OnCaps(f func(Caps))
OnCaps registers f to be called with the server's limits once the channel opens.
func (*DisplayControlClient) OnClose ¶
func (c *DisplayControlClient) OnClose()
OnClose implements drdynvc.DynChannel.
func (*DisplayControlClient) OnData ¶
func (c *DisplayControlClient) OnData(data []byte)
OnData implements drdynvc.DynChannel. The only message the server sends on this channel is its capabilities, which arrive once.
func (*DisplayControlClient) OnOpen ¶
func (c *DisplayControlClient) OnOpen(channelID uint32)
OnOpen implements drdynvc.DynChannel.
func (*DisplayControlClient) Process ¶ added in v0.8.0
func (c *DisplayControlClient) Process(s []byte)
Process consumes one payload from the static channel.
func (*DisplayControlClient) RequestResize ¶
func (c *DisplayControlClient) RequestResize(width, height int) error
RequestResize asks the server to change the primary monitor to width by height. The whole layout has to be sent, not just the one monitor that changed, so a single monitor layout is built here.
The width is rounded down to an even number, which is what the server requires and what FreeRDP sends. Sizes outside the range the server accepts are refused rather than clamped, so that a caller is not told its request succeeded when the size was quietly changed.
func (*DisplayControlClient) Sender ¶ added in v0.8.0
func (c *DisplayControlClient) Sender(f core.ChannelSender)
Sender installs the static channel's writer.
Display Control can travel on either channel, and the messages are the same on both, so this handler speaks whichever one the server set up. Windows joins the static channel and never creates the dynamic one, so this is the path that actually works there.
type Monitor ¶
type Monitor struct {
// Flags is monitorPrimary for the primary monitor and zero otherwise.
Flags uint32
// Left and Top are the monitor's origin relative to the primary monitor's
// upper left corner, which is always (0, 0).
Left int32
Top int32
// Width and Height are the desktop resolution of the monitor. The server
// requires an even width.
Width uint32
Height uint32
// PhysicalWidth and PhysicalHeight are the size in millimetres, which is
// what the server uses to work out the dots per inch.
PhysicalWidth uint32
PhysicalHeight uint32
// Orientation is one of the DISPLAY_CONTROL_ROTATION values.
Orientation uint32
// DesktopScaleFactor and DeviceScaleFactor are the scale percentages.
DesktopScaleFactor uint32
DeviceScaleFactor uint32
}
Monitor is one entry of a display layout: where a monitor sits and how big it is, in pixels and in millimetres.
func ParseMonitorLayout ¶
ParseMonitorLayout reads a layout PDU back. It exists so that the bytes this package produces can be checked against the structures they claim to be, and so that a server's layout could be read if one ever sent it.