modus
Menu
On this page

The entry remote_display

The source src/modules/system/remote_display built with the setting DRAWING_THROUGH_MODULE=true. The text after this paragraph is the comment of that source.

The remote display: the screen of the machine for a viewer on another machine, and the keys and the pointer of that viewer .

QUIC in the process (src/library/modus/quic), over a datagram endpoint with a listen grant of UDP on the port remote_display.LISTEN_PORT that admits the address of the host only, as remote has. The viewer proves its own Ed25519 key in the handshake (mutual TLS 1.3 with raw public keys), and this process takes it only when the client table that the root service writes has a row for it whose uses hold View. Each connection is bound to its row: when the grant of the row ends, or when the row loses View, the connection ends with the code Revoked.

The viewer opens one bidirectional stream. This process writes the screen in its direction: Screen_Size, then viewer frames of screen pieces from its copy of the screen, one viewer frame in flight. The viewer writes Viewer_Frame_Taken, a Screen_Piece_Request, and, for a row that holds Input, its keys and its pointer, which go to the compositor on the ring of the window of this process (modus:contract/remote_display). A record that its border refuses ends the connection with Bad_Record, a record past its bound with Too_Large, and a key of a row of the view alone with Input_Not_Allowed.

The capture face of the compositor: while a viewer is connected, this process gives the compositor the memory of two pictures and a header (display.Capture_Open), copies the rectangles of each Capture_Frame into its own copy of the screen, and gives the picture back. It copies only while no viewer is in the middle of a viewer frame, so that each viewer frame shows one moment: a slow viewer delays the copy, never the compositor, which merges the damage while the picture is held. With no viewer, it closes the face, and the mark of a viewer leaves the bar.

Start: start("remote_display") in the console. Read the public key on the log. Then allow the key of the viewer from a console that acts for the principal: remote_display_allow("<key>", "view"), or "view_and_input".

Grants, as the root service gives them:

  • Network: a listen grant of UDP on port 7101 for the address 10.0.2.2 only. The process refuses any other grant.
  • Remote_Clients: the client table, read-only.
  • Screen_Capture: the capture face and the input face of the compositor, on the ring of its window. It opens no surface.

What it proves: the screen reaches another machine only for a key that a principal allowed for the view, the keys of that machine reach the desktop only for a key allowed for the input, and the bar shows each session.

See: The remote display in the repository, QUIC: The remote display

remote_display module with an entry

Hash
ed446e3b1dad15460379f3097000e3384e9089012c0556f85614d1d23ce30c36
Size
206864 bytes
Exports
0
Imports
2
Imported by
0
License
MIT

The remote display: the screen of the machine for a viewer on another machine, and the keys and the pointer of that viewer (

FactValue
KindModules with an entry
Sourcesrc/modules/system/remote_display
Boot imageyes: in the boot image, 206864 bytes in this build
Build settings
  • DRAWING_THROUGH_MODULE=true
Imports
Imported bynone

Neighbours

What it imports, at its left, and what imports it, at its right: the part of the module graph that touches it.

remote_display cryptography drawing

Exports

ExportWhat it does
entry()The entry of the remote display: it makes its key, checks its grants, then runs QUIC, the viewers and the capture face until the machine stops

entry

entry()

The entry of the remote display: it makes its key, checks its grants, then runs QUIC, the viewers and the capture face until the machine stops.

The entry, in order:

  1. 1. takes the random generator of its context and makes its Ed25519 key; with a seed under the strength "processor" it writes "remote_display: the random seed of this process is weak" and stops;
  2. 2. writes "remote_display: the public key of this service: " and 64 hexadecimal digits;
  3. 3. opens its datagram endpoint and the ring of its window, maps the client table read-only, and asks the network service for its grant; a grant that is not a listen grant of UDP for the host only stops it;
  4. 4. writes "remote_display: listening on the UDP port 7101, for the host 10.0.2.2 only, and for the viewer keys that a principal allowed".

Then one loop runs for ever. Each pass gives the arrived datagrams to the server, moves the viewers, takes the records of the compositor, copies a picture that waits, and opens or closes the capture face. The loop waits for a datagram, a record of the compositor, a change of the client table, the next deadline of QUIC, or the bound of a viewer frame.

Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
src/modules/system/remote_display/main.odin:1110

Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).

What the root service gives it

WhatValueAs the root service says
GrantsThe remote display: a listen grant of UDP that admits the address of the host only, the client table, which names the uses of the key of each viewer that a principal allowed, and the capture face and the input face of the compositor on the ring of its window . It calls no service. See: The remote display in the repository
Other terms of its start grant setnone
Budget that it asks for
  • working memory pages 6400
  • pages of its threads 72
  • pages of the pictures of its window 0
  • pages of the module and its imports from the files of the build
  • processes 1
  • threads 1
The copy of the screen of the largest screen, the two pictures and the header of the capture face, the QUIC connections and their streams, and the page tables of these mappings: 2025 + 4051 + about 300 + 24 = 6400.

The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).