Merge tag 'v9.0.0-rc3'
[qemu/ar7.git] / docs / interop / barrier.rst
blob055f2c1aef32454c308ee4a3aa677942022f12ed
1 Barrier client protocol
2 =======================
4 QEMU's ``input-barrier`` device implements the client end of
5 the KVM (Keyboard-Video-Mouse) software
6 `Barrier <https://github.com/debauchee/barrier>`__.
8 This document briefly describes the protocol as we implement it.
10 Message format
11 --------------
13 Message format between the server and client is in two parts:
15 #. the payload length, a 32bit integer in network endianness
16 #. the payload
18 The payload starts with a 4byte string (without NUL) which is the
19 command. The first command between the server and the client
20 is the only command not encoded on 4 bytes ("Barrier").
21 The remaining part of the payload is decoded according to the command.
23 Protocol Description
24 --------------------
26 This comes from ``barrier/src/lib/barrier/protocol_types.h``.
28 barrierCmdHello  "Barrier"
29 ^^^^^^^^^^^^^^^^^^^^^^^^^^
31 Direction:
32   server -> client
33 Parameters:
34   ``{ int16_t minor, int16_t major }``
35 Description:
36   Say hello to client
38   ``minor`` = protocol major version number supported by server
40   ``major`` = protocol minor version number supported by server
42 barrierCmdHelloBack  "Barrier"
43 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 Direction:
46   client ->server
47 Parameters:
48   ``{ int16_t minor, int16_t major, char *name}``
49 Description:
50   Respond to hello from server
52   ``minor`` = protocol major version number supported by client
54   ``major`` = protocol minor version number supported by client
56   ``name``  = client name
58 barrierCmdDInfo  "DINF"
59 ^^^^^^^^^^^^^^^^^^^^^^^
61 Direction:
62   client ->server
63 Parameters:
64   ``{ int16_t x_origin, int16_t y_origin, int16_t width, int16_t height, int16_t x, int16_t y}``
65 Description:
66   The client screen must send this message in response to the
67   barrierCmdQInfo message.  It must also send this message when the
68   screen's resolution changes.  In this case, the client screen should
69   ignore any barrierCmdDMouseMove messages until it receives a
70   barrierCmdCInfoAck in order to prevent attempts to move the mouse off
71   the new screen area.
73 barrierCmdCNoop  "CNOP"
74 ^^^^^^^^^^^^^^^^^^^^^^^
76 Direction:
77   client -> server
78 Parameters:
79   None
80 Description:
81   No operation
83 barrierCmdCClose "CBYE"
84 ^^^^^^^^^^^^^^^^^^^^^^^
86 Direction:
87   server -> client
88 Parameters:
89   None
90 Description:
91   Close connection
93 barrierCmdCEnter "CINN"
94 ^^^^^^^^^^^^^^^^^^^^^^^
96 Direction:
97   server -> client
98 Parameters:
99   ``{ int16_t x, int16_t y, int32_t seq, int16_t modifier }``
100 Description:
101   Enter screen.
103   ``x``, ``y``  = entering screen absolute coordinates
105   ``seq``  = sequence number, which is used to order messages between
106   screens.  the secondary screen must return this number
107   with some messages
109   ``modifier`` = modifier key mask.  this will have bits set for each
110   toggle modifier key that is activated on entry to the
111   screen.  the secondary screen should adjust its toggle
112   modifiers to reflect that state.
114 barrierCmdCLeave "COUT"
115 ^^^^^^^^^^^^^^^^^^^^^^^
117 Direction:
118   server -> client
119 Parameters:
120   None
121 Description:
122   Leaving screen.  the secondary screen should send clipboard data in
123   response to this message for those clipboards that it has grabbed
124   (i.e. has sent a barrierCmdCClipboard for and has not received a
125   barrierCmdCClipboard for with a greater sequence number) and that
126   were grabbed or have changed since the last leave.
128 barrierCmdCClipboard "CCLP"
129 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
131 Direction:
132   server -> client
133 Parameters:
134   ``{ int8_t id, int32_t seq }``
135 Description:
136   Grab clipboard. Sent by screen when some other app on that screen
137   grabs a clipboard.
139   ``id``  = the clipboard identifier
141   ``seq`` = sequence number. Client must use the sequence number passed in
142   the most recent barrierCmdCEnter.  the server always sends 0.
144 barrierCmdCScreenSaver   "CSEC"
145 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
147 Direction:
148   server -> client
149 Parameters:
150   ``{ int8_t started }``
151 Description:
152   Screensaver change.
154   ``started`` = Screensaver on primary has started (1) or closed (0)
156 barrierCmdCResetOptions  "CROP"
157 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
159 Direction:
160   server -> client
161 Parameters:
162   None
163 Description:
164   Reset options. Client should reset all of its options to their
165   defaults.
167 barrierCmdCInfoAck   "CIAK"
168 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
170 Direction:
171   server -> client
172 Parameters:
173   None
174 Description:
175   Resolution change acknowledgment. Sent by server in response to a
176   client screen's barrierCmdDInfo. This is sent for every
177   barrierCmdDInfo, whether or not the server had sent a barrierCmdQInfo.
179 barrierCmdCKeepAlive "CALV"
180 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
182 Direction:
183   server -> client
184 Parameters:
185   None
186 Description:
187   Keep connection alive. Sent by the server periodically to verify
188   that connections are still up and running.  clients must reply in
189   kind on receipt.  if the server gets an error sending the message or
190   does not receive a reply within a reasonable time then the server
191   disconnects the client.  if the client doesn't receive these (or any
192   message) periodically then it should disconnect from the server.  the
193   appropriate interval is defined by an option.
195 barrierCmdDKeyDown   "DKDN"
196 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
198 Direction:
199   server -> client
200 Parameters:
201   ``{ int16_t keyid, int16_t modifier [,int16_t button] }``
202 Description:
203   Key pressed.
205   ``keyid`` = X11 key id
207   ``modified`` = modified mask
209   ``button`` = X11 Xkb keycode (optional)
211 barrierCmdDKeyRepeat "DKRP"
212 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
214 Direction:
215   server -> client
216 Parameters:
217   ``{ int16_t keyid, int16_t modifier, int16_t repeat [,int16_t button] }``
218 Description:
219   Key auto-repeat.
221   ``keyid`` = X11 key id
223   ``modified`` = modified mask
225   ``repeat``   = number of repeats
227   ``button``   = X11 Xkb keycode (optional)
229 barrierCmdDKeyUp "DKUP"
230 ^^^^^^^^^^^^^^^^^^^^^^^
232 Direction:
233   server -> client
234 Parameters:
235   ``{ int16_t keyid, int16_t modifier [,int16_t button] }``
236 Description:
237   Key released.
239   ``keyid`` = X11 key id
241   ``modified`` = modified mask
243   ``button`` = X11 Xkb keycode (optional)
245 barrierCmdDMouseDown "DMDN"
246 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
248 Direction:
249   server -> client
250 Parameters:
251   ``{ int8_t button }``
252 Description:
253   Mouse button pressed.
255   ``button`` = button id
257 barrierCmdDMouseUp   "DMUP"
258 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
260 Direction:
261   server -> client
262 Parameters:
263   ``{ int8_t button }``
264 Description:
265   Mouse button release.
267   ``button`` = button id
269 barrierCmdDMouseMove "DMMV"
270 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
272 Direction:
273   server -> client
274 Parameters:
275   ``{ int16_t x, int16_t y }``
276 Description:
277   Absolute mouse moved.
279   ``x``, ``y`` = absolute screen coordinates
281 barrierCmdDMouseRelMove  "DMRM"
282 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
284 Direction:
285   server -> client
286 Parameters:
287   ``{ int16_t x, int16_t y }``
288 Description:
289   Relative mouse moved.
291   ``x``, ``y`` = r relative screen coordinates
293 barrierCmdDMouseWheel "DMWM"
294 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
296 Direction:
297   server -> client
298 Parameters:
299   ``{ int16_t x , int16_t y }`` or ``{ int16_t y }``
300 Description:
301   Mouse scroll. The delta should be +120 for one tick forward (away
302   from the user) or right and -120 for one tick backward (toward the
303   user) or left.
305   ``x`` = x delta
307   ``y`` = y delta
309 barrierCmdDClipboard "DCLP"
310 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
312 Direction:
313   server -> client
314 Parameters:
315   ``{ int8_t id, int32_t seq, int8_t mark, char *data }``
316 Description:
317   Clipboard data.
319   ``id``  = clipboard id
321   ``seq`` = sequence number. The sequence number is 0 when sent by the
322   server.  Client screens should use the/ sequence number from
323   the most recent barrierCmdCEnter.
325 barrierCmdDSetOptions "DSOP"
326 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
328 Direction:
329   server -> client
330 Parameters:
331   ``{ int32 t nb, { int32_t id, int32_t val }[] }``
332 Description:
333   Set options. Client should set the given option/value pairs.
335   ``nb``  = numbers of ``{ id, val }`` entries
337   ``id``  = option id
339   ``val`` = option new value
341 barrierCmdDFileTransfer "DFTR"
342 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
344 Direction:
345   server -> client
346 Parameters:
347   ``{ int8_t mark, char *content }``
348 Description:
349   Transfer file data.
351   * ``mark`` = 0 means the content followed is the file size
352   * 1 means the content followed is the chunk data
353   * 2 means the file transfer is finished
355 barrierCmdDDragInfo  "DDRG"
356 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
358 Direction:
359   server -> client
360 Parameters:
361   ``{ int16_t nb, char *content }``
362 Description:
363   Drag information.
365   ``nb``  = number of dragging objects
367   ``content`` = object's directory
369 barrierCmdQInfo  "QINF"
370 ^^^^^^^^^^^^^^^^^^^^^^^
372 Direction:
373   server -> client
374 Parameters:
375   None
376 Description:
377   Query screen info
379   Client should reply with a barrierCmdDInfo
381 barrierCmdEIncompatible  "EICV"
382 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
384 Direction:
385   server -> client
386 Parameters:
387   ``{ int16_t nb, major *minor }``
388 Description:
389   Incompatible version.
391   ``major`` = major version
393   ``minor`` = minor version
395 barrierCmdEBusy  "EBSY"
396 ^^^^^^^^^^^^^^^^^^^^^^^
398 Direction:
399   server -> client
400 Parameters:
401   None
402 Description:
403   Name provided when connecting is already in use.
405 barrierCmdEUnknown   "EUNK"
406 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
408 Direction:
409   server -> client
410 Parameters:
411   None
412 Description:
413   Unknown client. Name provided when connecting is not in primary's
414   screen configuration map.
416 barrierCmdEBad   "EBAD"
417 ^^^^^^^^^^^^^^^^^^^^^^^
419 Direction:
420   server -> client
421 Parameters:
422   None
423 Description:
424   Protocol violation. Server should disconnect after sending this
425   message.