1<?xml version="1.0" encoding="UTF-8" ?> 2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" 4[ 5<!ENTITY % defs SYSTEM "defs.ent"> %defs; 6]> 7 8 9<!-- lifted from troff+ms+XMan by doclifter --> 10<book id="record"> 11 12<bookinfo> 13 <title>Record Extension Protocol Specification</title> 14 <subtitle>X Consortium Standard</subtitle> 15 <authorgroup> 16 <author> 17 <firstname>Martha</firstname><surname>Zimet</surname> 18 <affiliation><orgname>Network Computing Devices, Inc.</orgname></affiliation> 19 </author> 20 <editor> 21 <firstname>Stephen</firstname><surname>Gildea</surname> 22 <affiliation><orgname>X Consortium</orgname></affiliation> 23 </editor> 24 </authorgroup> 25 <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo> 26 <copyright><year>1994</year><holder>Network Computing Devices, Inc.</holder> 27 </copyright> 28 29<legalnotice> 30<para> 31Permission to use, copy, modify, distribute, and sell this 32documentation for any purpose is hereby granted without fee, 33provided that the above copyright notice and this permission 34notice appear in all copies. Network Computing Devices, Inc. 35makes no representations about the suitability for any purpose 36of the information in this document. This documentation is 37provided “as is” without express or implied warranty. 38</para> 39</legalnotice> 40 41<legalnotice> 42<para role="multiLicensing">Copyright © 1994, 1995 X Consortium</para> 43<para> 44Permission is hereby granted, free of charge, to any person obtaining 45a copy of this software and associated documentation files (the 46"Software"), to deal in the Software without restriction, including 47without limitation the rights to use, copy, modify, merge, publish, 48distribute, sublicense, and/or sell copies of the Software, and to 49permit persons to whom the Software is furnished to do so, subject to 50the following conditions: 51</para> 52 53<para> 54The above copyright notice and this permission notice shall be included 55in all copies or substantial portions of the Software. 56</para> 57 58<para> 59THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 60EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 61MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 62IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 63OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 64ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 65OTHER DEALINGS IN THE SOFTWARE. 66</para> 67 68<para> 69Except as contained in this notice, the name of the X Consortium and 70shall not be used in advertising or otherwise to promote the sale, use 71or other dealings in this Software without prior written authorization 72from the X Consortium. 73</para> 74<para>X Window System is a trademark of The Open Group.</para> 75</legalnotice> 76</bookinfo> 77 78<chapter id="Introduction"> 79<title>Introduction</title> 80<para> 81Several proposals have been written over the past few years that address some 82of the issues surrounding the recording and playback of user actions 83in the X Window System<footnote><para> 84<emphasis remap='I'>X Window System</emphasis> is a trademark of The Open Group. 85</para></footnote> 86: 87</para> 88 89<itemizedlist> 90 <listitem> 91 <para> 92<emphasis remap='I'>Some Proposals for a Minimal X11 Testing Extension</emphasis>, 93Kieron Drake, UniSoft Ltd., April 1991 94 </para> 95 </listitem> 96 <listitem> 97 <para> 98<emphasis remap='I'>X11 Input Synthesis Extension Proposal</emphasis>, Larry Woestman, 99Hewlett Packard, November 1991 100 </para> 101 </listitem> 102 <listitem> 103 <para> 104<emphasis remap='I'>XTrap Architecture</emphasis>, Dick Annicchiario, et al, Digital Equipment Corporation, 105July 1991 106 </para> 107 </listitem> 108 <listitem> 109 <para> 110<emphasis remap='I'>XTest Extension Recording Specification</emphasis>, Yochanan Slonim, 111Mercury Interactive, December 1992 112 </para> 113 </listitem> 114</itemizedlist> 115 116<para> 117This document both unifies and extends the previous diverse approaches 118to generate a proposal for an X extension that provides support for 119the recording of all core X protocol and arbitrary extension protocol. 120Input synthesis, or playback, has already been implemented in the 121XTest extension, an X Consortium standard. Therefore, this extension 122is limited to recording. 123</para> 124 125<para> 126In order to provide both record and playback functionality, a 127hypothetical record application could use this extension to capture 128both user actions and their consequences. For example, a button press 129(a user action) may cause a window to be mapped and a corresponding 130<function>MapNotify</function> 131event to be sent (a consequence). This information could be 132stored for later use by a playback application. 133</para> 134 135<para> 136The playback application could use the recorded actions as input for 137the XTest extension's 138<function>XTestFakeInput</function> 139operation to synthesize the 140appropriate input events. The "consequence" or synchronization 141information is then used as a synchronization point during playback. 142That is, the playback application does not generate specific 143synthesized events until their matching synchronization condition 144occurs. When the condition occurs the processing of synthesized 145events continues. Determination that the condition has occurred may be 146made by capturing the consequences of the synthesized events and 147comparing them to the previously recorded synchronization information. 148For example, if a button press was followed by a 149<function>MapNotify</function> 150event on a 151particular window in the recorded data, the playback application might 152synthesize the button press then wait for the 153<function>MapNotify</function> 154event on the 155appropriate window before proceeding with subsequent synthesized 156input. 157</para> 158 159<para> 160Because 161it is impossible to predict what synchronization information will be 162required by a particular application, the extension provides 163facilities to record any subset of core X protocol and arbitrary 164extension protocol. 165As such, this extension does not enforce a specific 166synchronization methodology; any method based on information in the X 167protocol stream (e.g., watching for window mapping/unmapping, cursor 168changes, drawing of certain text strings, etc.) can capture the 169information it needs using RECORD facilities. 170</para> 171 172<sect1 id="Acknowledgements"> 173<title>Acknowledgements</title> 174<para> 175The document represents the culmination of two years of debate and 176experiments done under the auspices of the X Consortium xtest working 177group. Although this was a group effort, the author remains 178responsible for any errors or omissions. 179Two years ago, Robert Chesler of Absol-puter, Kieron Drake of UniSoft 180Ltd., Marc Evans of Synergytics and Ken Miller of Digital shared the 181vision of a standard extension for recording and were all instrumental 182in the early protocol development. During the last two years, Bob 183Scheifler of the X Consortium and Jim Fulton of NCD continuously 184provided input to the protocol design, as well as encouragement to the 185author. In the last few months, Stephen Gildea and Dave Wiggins, 186both X Consortium staff, have spent considerable time fine tuning the 187protocol design and reviewing the protocol specifications. Most 188recently, Amnon Cohen of Mercury Interactive has assisted in 189clarification of the recorded event policy, and Kent Siefkes of 190Performance Awareness has assisted in clarification of the timestamp 191policy. 192</para> 193</sect1> 194 195<sect1 id="Goals"> 196<title>Goals</title> 197<itemizedlist> 198 <listitem> 199 <para> 200To provide a standard for recording, 201whereby both device events and synchronization information in the 202form of device event consequences are recorded. 203 </para> 204 </listitem> 205 <listitem> 206 <para> 207To record contextual information used in synchronized playback 208without prior knowledge of the application 209that 210is being recorded. 211 </para> 212 </listitem> 213 <listitem> 214 <para> 215To provide the ability to record arbitrary X protocol extensions. 216<!-- .RE --> 217 </para> 218 </listitem> 219</itemizedlist> 220</sect1> 221 222<sect1 id="Requirements"> 223<title>Requirements</title> 224<para> 225The extension should function as follows: 226</para> 227 228<itemizedlist> 229 <listitem> 230 <para> 231It should 232not be dependent on other clients or extensions for its operation. 233 </para> 234 </listitem> 235 <listitem> 236 <para> 237It should 238not significantly impact performance. 239 </para> 240 </listitem> 241 <listitem> 242 <para> 243It should 244support the recording of all device input (core devices and XInput devices). 245 </para> 246 </listitem> 247 <listitem> 248 <para> 249It should 250be extendible. 251 </para> 252 </listitem> 253 <listitem> 254 <para> 255It should 256support the recording of synchronization information for user events. 257 </para> 258 </listitem> 259</itemizedlist> 260</sect1> 261</chapter> 262 263<chapter id="Design"> 264<title>Design</title> 265<para> 266This section gives an overview of the RECORD extension and discusses 267its overall operation and data types. 268</para> 269 270<sect1 id="Overview"> 271<title>Overview</title> 272<para> 273The mechanism used by this extension for recording is to intercept 274core X protocol and arbitrary X extension protocol entirely within the X server 275itself. When the extension has been requested to intercept specific 276protocol by one or more clients, the protocol data are formatted and 277returned to the recording clients. 278</para> 279<para> 280<!-- .LP --> 281The extension provides a mechanism for capturing all events, including 282input device events that go to no clients, that is analogous to a client 283expressing "interest" in all events in all windows, including the root 284window. Event filtering in the extension provides a mechanism for feeding 285device events to recording clients; it does not provide a mechanism for 286in-place, synchronous event substitution, modification, or withholding. 287In addition, the 288extension does not provide data compression before intercepted protocol 289is returned to the recording clients. 290</para> 291<sect2 id="Data_Delivery"> 292<title>Data Delivery</title> 293<!-- .XS --> 294<!-- (SN Data Delivery --> 295<!-- .XE --> 296<para> 297<!-- .LP --> 298Because 299events are limited in size to 30032 bytes, using events to return intercepted protocol data to recording 301clients is prohibitive in terms of performance. Therefore, intercepted 302protocol data are returned to recording clients through multiple replies 303to the extension request to begin protocol interception and reporting. 304This utilization is consistent with 305<function>ListFontsWithInfo ,</function> 306for example, where a 307single request has multiple replies. 308</para> 309<para> 310<!-- .LP --> 311Individual requests, replies, events or errors intercepted by the extension 312on behalf of recording clients cannot be split across reply packets. In order 313to reduce overhead, multiple intercepted requests, replies, events and errors 314might be collected 315into a single reply. 316Nevertheless, all data are returned to the client in a timely manner. 317</para> 318</sect2> 319<sect2 id="Record_Context"> 320<title>Record Context</title> 321<!-- .XS --> 322<!-- (SN Record Context --> 323<!-- .XE --> 324<para> 325<!-- .LP --> 326The extension adds a record context resource (RC) 327to the set of resources managed by the server. All the 328extension operations take an RC as an argument. Although the protocol 329permits sharing of RCs between clients, it is expected that clients will 330use their own RCs. The attributes used in extension operations are stored 331in the RCs, and these attributes include the protocol and clients to 332intercept. 333</para> 334<para> 335<!-- .LP --> 336The terms "register" and "unregister" are used to describe the 337relationship between clients to intercept and the RC. To register 338a client with an RC means the client is added to the list 339of clients to intercept; to unregister a client means the client 340is deleted from the list of clients to intercept. When the 341server is requested to register or unregister clients from an RC, 342it is required to do so immediately. That is, it is not permissible for 343the server to wait until recording is enabled to register clients 344or recording is disabled to unregister clients. 345</para> 346</sect2> 347 348<sect2 id="Record_Client_Connections"> 349<title>Record Client Connections</title> 350<!-- .XS --> 351<!-- (SN Record Client Connections --> 352<!-- .XE --> 353<para> 354<!-- .LP --> 355The typical communication model for a recording client is to open 356two connections to the server and use one for RC control and 357the other for reading protocol data. 358</para> 359<para> 360<!-- .LP --> 361The "control" connection can execute requests to obtain information about 362the supported protocol version, create and destroy RCs, specify protocol 363types to intercept and clients to be recorded, query the current state 364of an RC, and to stop interception and reporting of protocol data. The 365"data" connection can execute a request to 366enable interception 367and reporting of specified protocol for a particular RC. When the 368"enable" request is issued, intercepted protocol is sent back on the 369same connection, generally in more than one reply packet. Until the last 370reply to the "enable" request is sent by the server, signifying that 371the request execution is complete, no other requests will be executed by 372the server on that connection. That is, the connection that data are being 373reported on cannot issue the "disable" request until the last reply 374to the "enable" request is sent by the server. Therefore, unless a 375recording client never has the need to disable the interception and reporting 376of protocol data, two client connections are necessary. 377</para> 378</sect2> 379<sect2 id="Events"> 380<title>Events</title> 381<!-- .XS --> 382<!-- (SN Events --> 383<!-- .XE --> 384<para> 385<!-- .LP --> 386The terms "delivered events" and "device events" are used 387to describe the two event classes recording clients may 388select for interception. These event classes are handled differently 389by the extension. Delivered events are core X events or X extension events 390the server actually delivers to one or more clients. Device events are 391events generated by core X devices or extension input devices that the 392server may or may not deliver to any clients. When device events 393are selected for interception by a recording client, the extension 394guarantees each device event is recorded and will be forwarded 395to the recording client in the same order it is generated by the 396device. 397</para> 398<para> 399<!-- .LP --> 400The recording of selected device events is not affected 401by server grabs. Delivered events, on the other hand, can be affected 402by server grabs. 403If a recording client selects both 404a device event and delivered events that result from that device 405event, the delivered events are recorded after the device event. 406In the absence of grabs, the delivered events for a 407device event precede later device events. 408</para> 409<para> 410<!-- .LP --> 411Requests that have side effects on 412devices, such as 413<function>WarpPointer</function> 414and 415<function>GrabPointer</function> 416with a confine-to window, 417will cause RECORD to record an associated device event. 418The XTEST extension request 419<function>XTestFakeInput</function> 420causes a device event to be recorded; the 421device events are recorded in the same order that the 422<function>XTestFakeInput</function> 423requests are received by the server. 424</para> 425<para> 426<!-- .LP --> 427If a key autorepeats, multiple 428<function>KeyPress</function> 429and 430<function>KeyRelease</function> 431device events are reported. 432</para> 433</sect2> 434 435<sect2 id="Timing"> 436<title>Timing</title> 437<!-- .XS --> 438<!-- (SN Timing --> 439<!-- .XE --> 440<para> 441Requests are recorded just before 442they are executed; the time associated with a request is the server 443time when it is recorded. 444</para> 445</sect2> 446</sect1> 447 448<sect1 id="Types"> 449<title>Types</title> 450<para> 451The following new types are used in the request definitions that appear 452in section 3. <!-- xref --> 453</para> 454 455<para>RC: CARD32</para> 456 457<para> 458The 459<function>"RC"</function> 460type is a resource identifier for a server record context. 461</para> 462 463<informaltable frame="none"> 464 <?dbfo keep-together="always" ?> 465 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 466 <colspec colname='c1' colwidth="1.0*"/> 467 <colspec colname='c2' colwidth="1.0*"/> 468 <colspec colname='c3' colwidth="4.0*"/> 469 <tbody> 470 <row> 471 <entry>RANGE8:</entry> 472 <entry>[first, last:</entry> 473 <entry>CARD8]</entry> 474 </row> 475 <row> 476 <entry>RANGE16:</entry> 477 <entry>[first, last:</entry> 478 <entry>CARD16]</entry> 479 </row> 480 <row> 481 <entry>EXTRANGE:</entry> 482 <entry>[major:</entry> 483 <entry>RANGE8</entry> 484 </row> 485 <row> 486 <entry></entry> 487 <entry>minor:</entry> 488 <entry>RANGE16]</entry> 489 </row> 490 </tbody> 491 </tgroup> 492</informaltable> 493 494<informaltable frame="none"> 495 <?dbfo keep-together="always" ?> 496 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 497 <colspec colname='c1' colwidth="1.5*"/> 498 <colspec colname='c2' colwidth="1.0*"/> 499 <colspec colname='c3' colwidth="4.0*"/> 500 <tbody> 501 <row> 502 <entry>RECORDRANGE:</entry> 503 <entry>[core-requests:</entry> 504 <entry>RANGE8</entry> 505 </row> 506 <row> 507 <entry></entry> 508 <entry>core-replies:</entry> 509 <entry>RANGE8</entry> 510 </row> 511 <row> 512 <entry></entry> 513 <entry>ext-requests:</entry> 514 <entry>EXTRANGE</entry> 515 </row> 516 <row> 517 <entry></entry> 518 <entry>ext-replies:</entry> 519 <entry>EXTRANGE</entry> 520 </row> 521 <row> 522 <entry></entry> 523 <entry>delivered-events:</entry> 524 <entry>RANGE8</entry> 525 </row> 526 <row> 527 <entry></entry> 528 <entry>device-events:</entry> 529 <entry>RANGE8</entry> 530 </row> 531 <row> 532 <entry></entry> 533 <entry>errors:</entry> 534 <entry>RANGE8</entry> 535 </row> 536 <row> 537 <entry></entry> 538 <entry>client-started:</entry> 539 <entry>BOOL</entry> 540 </row> 541 <row> 542 <entry></entry> 543 <entry>client-died:</entry> 544 <entry>BOOL]</entry> 545 </row> 546 </tbody> 547 </tgroup> 548</informaltable> 549 550<para> 551The 552<function>"RECORDRANGE"</function> 553structure contains the protocol values to intercept. Typically, 554this structure is sent by recording clients over the control connection 555when creating or modifying an RC. 556</para> 557 558<itemizedlist> 559 <listitem> 560 <para> 561<!-- .IN "core-requests" --> 562<!-- .br --> 563Specifies core X protocol requests with an opcode field between <emphasis remap='I'>first</emphasis> 564and <emphasis remap='I'>last</emphasis> inclusive. If <emphasis remap='I'>first</emphasis> is equal to 0 and <emphasis remap='I'>last</emphasis> is equal to 0, no 565core requests are specified by this RECORDRANGE. If <emphasis remap='I'>first</emphasis> is greater 566than <emphasis remap='I'>last</emphasis>, a 567<function>"Value"</function> 568error results. 569 </para> 570 </listitem> 571 <listitem> 572 <para> 573<!-- .IN "core-replies" --> 574<!-- .br --> 575Specifies replies resulting from core X protocol requests with an opcode 576field between <emphasis remap='I'>first</emphasis> and <emphasis remap='I'>last</emphasis> inclusive. If <emphasis remap='I'>first</emphasis> is equal to 0 and <emphasis remap='I'>last</emphasis> 577is equal to 0, no core replies are specified by this RECORDRANGE. If 578<emphasis remap='I'>first</emphasis> is greater than <emphasis remap='I'>last</emphasis>, a 579<function>"Value"</function> 580error results. 581 </para> 582 </listitem> 583 <listitem> 584 <para> 585<!-- .IN "ext-requests" --> 586<!-- .br --> 587Specifies extension protocol requests with a major opcode field between 588<emphasis remap='I'>major.first</emphasis> and <emphasis remap='I'>major.last</emphasis> and a minor opcode field between <emphasis remap='I'>minor.first</emphasis> 589and <emphasis remap='I'>minor.last</emphasis> inclusive. 590If <emphasis remap='I'>major.first</emphasis> and <emphasis remap='I'>major.last</emphasis> are equal to 0, no 591extension protocol requests are specified by this RECORDRANGE. If 592<emphasis remap='I'>major.first</emphasis> or <emphasis remap='I'>major.last</emphasis> is less than 128 and greater than 0, 593if <emphasis remap='I'>major.first</emphasis> is greater than <emphasis remap='I'>major.last</emphasis>, 594or if <emphasis remap='I'>minor.first</emphasis> 595is greater than <emphasis remap='I'>minor.last</emphasis>, a 596<function>"Value"</function> 597error results. 598 </para> 599 </listitem> 600 <listitem> 601 <para> 602<!-- .IN "ext-replies" --> 603<!-- .br --> 604Specifies replies resulting from extension protocol requests with a 605major opcode field between <emphasis remap='I'>major.first</emphasis> and <emphasis remap='I'>major.last</emphasis> and 606a minor opcode field between <emphasis remap='I'>minor.first</emphasis> and <emphasis remap='I'>minor.last</emphasis> 607inclusive. If <emphasis remap='I'>major.first</emphasis> and <emphasis remap='I'>major.last</emphasis> are equal to 0, 608no extension protocol replies are specified by this RECORDRANGE. If 609<emphasis remap='I'>major.first</emphasis> or <emphasis remap='I'>major.last</emphasis> is less than 128 and greater 610than 0, 611if <emphasis remap='I'>major.first</emphasis> is greater than <emphasis remap='I'>major.last</emphasis>, 612or if <emphasis remap='I'>minor.first</emphasis> is greater than <emphasis remap='I'>minor.last</emphasis>, a 613<function>"Value"</function> 614error results. 615 </para> 616 </listitem> 617 <listitem> 618 <para> 619<!-- .IN "delivered-events" --> 620<!-- .br --> 621This is used for both core X protocol events and arbitrary extension 622events. Specifies events that are delivered to at least one client 623that have a code field between <emphasis remap='I'>first</emphasis> and <emphasis remap='I'>last</emphasis> 624inclusive. If <emphasis remap='I'>first</emphasis> is equal to 0 and <emphasis remap='I'>last</emphasis> is equal to 0, 625no events are specified by this RECORDRANGE. 626Otherwise, if <emphasis remap='I'>first</emphasis> is less than 2 627or <emphasis remap='I'>last</emphasis> is less than 2, or if 628<emphasis remap='I'>first</emphasis> is greater than <emphasis remap='I'>last</emphasis>, a 629<function>"Value"</function> 630error results. 631 </para> 632 </listitem> 633 <listitem> 634 <para> 635<!-- .IN "device-events" --> 636<!-- .br --> 637This is used for both core X device events and X extension device 638events that may or may not be delivered to a client. 639Specifies device events that have a code field between <emphasis remap='I'>first</emphasis> and 640<emphasis remap='I'>last</emphasis> inclusive. If <emphasis remap='I'>first</emphasis> is equal to 0 and <emphasis remap='I'>last</emphasis> 641is equal to 0, no device events are specified by this RECORDRANGE. 642Otherwise, 643if <emphasis remap='I'>first</emphasis> is less than 2 or <emphasis remap='I'>last</emphasis> is less 644than 2, or if <emphasis remap='I'>first</emphasis> is greater than <emphasis remap='I'>last</emphasis>, a 645<function>"Value"</function> 646error results. 647 </para> 648 </listitem> 649 <listitem> 650 <para> 651Because 652the generated device event may or may not be associated with a 653client, unlike other RECORDRANGE components, which select protocol for a 654specific client, selecting for device events in any RECORDRANGE in an RC 655causes the recording client to receive one instance for each device event 656generated that is in the range specified. 657 </para> 658 </listitem> 659 <listitem> 660 <para> 661<!-- .IN "errors" --> 662<!-- .br --> 663This is used for both core X protocol errors and arbitrary extension 664errors. Specifies errors that have a code field between <emphasis remap='I'>first</emphasis> and 665<emphasis remap='I'>last</emphasis> inclusive. If <emphasis remap='I'>first</emphasis> is equal to 0 and <emphasis remap='I'>last</emphasis> is equal to 0, no 666errors are specified by this RECORDRANGE. If <emphasis remap='I'>first</emphasis> is greater 667than <emphasis remap='I'>last</emphasis>, a 668<function>"Value"</function> 669error results. 670 </para> 671 </listitem> 672 <listitem> 673 <para> 674<!-- .IN "client-started" --> 675<!-- .br --> 676Specifies the connection setup reply. 677If 678<function>False ,</function> 679the connection setup reply is not specified by 680this RECORDRANGE. 681 </para> 682 </listitem> 683 <listitem> 684 <para> 685<!-- .IN "client-died" --> 686<!-- .br --> 687Specifies notification when a client disconnects. 688If 689<function>False ,</function> 690notification when a client disconnects is not specified by 691this RECORDRANGE. 692 </para> 693 </listitem> 694</itemizedlist> 695 696<informaltable frame="none"> 697 <?dbfo keep-together="always" ?> 698 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 699 <colspec colname='c1' colwidth="1.0*"/> 700 <colspec colname='c2' colwidth="1.0*"/> 701 <colspec colname='c3' colwidth="2.0*"/> 702 <tbody> 703 <row> 704 <entry>ELEMENT_HEADER:</entry> 705 <entry>[from-server-time:</entry> 706 <entry>BOOL</entry> 707 </row> 708 <row> 709 <entry></entry> 710 <entry>from-client-time:</entry> 711 <entry>BOOL</entry> 712 </row> 713 <row> 714 <entry></entry> 715 <entry>from-client-sequence:</entry> 716 <entry>BOOL]</entry> 717 </row> 718 </tbody> 719 </tgroup> 720</informaltable> 721 722<para> 723The 724<function>ELEMENT_HEADER</function> 725structure specifies additional data that precedes each protocol 726element in the <emphasis remap='I'>data</emphasis> field of a 727<function>RecordEnableContext</function> 728reply. 729</para> 730 731<itemizedlist> 732 <listitem> 733 <para> 734If <emphasis remap='I'>from-server-time</emphasis> is 735<function>True ,</function> 736each intercepted protocol element 737with category 738<function>FromServer</function> 739is preceded by the server time when the protocol was recorded. 740 </para> 741 </listitem> 742 <listitem> 743 <para> 744If <emphasis remap='I'>from-client-time</emphasis> is 745<function>True ,</function> 746each intercepted protocol element 747with category 748<function>FromClient</function> 749is preceded by the server time when the protocol was recorded. 750 </para> 751 </listitem> 752 <listitem> 753 <para> 754If <emphasis remap='I'>from-client-sequence</emphasis> is 755<function>True ,</function> 756each intercepted protocol 757element with category 758<function>FromClient</function> 759or 760<function>ClientDied</function> 761is preceded by the 76232-bit sequence number of the recorded client's most recent request 763processed by the server at that time. 764For 765<function>FromClient ,</function> 766this will be one less than the sequence number of the 767following request. 768For 769<function>ClientDied ,</function> 770the sequence number will be the only data, because no 771protocol is recorded. 772 </para> 773 </listitem> 774</itemizedlist> 775 776<para> 777Note that a reply containing device events is treated the same as 778other replies with category 779<function>FromServer</function> 780for purposes of these flags. 781Protocol with category 782<function>FromServer</function> 783is never preceded by a sequence 784number because almost all such protocol has a sequence number in it anyway. 785</para> 786 787<para> 788<!-- .LP --> 789If both a server time and a sequence number have been requested for a 790reply, each protocol request is 791preceded first by the time and second by the sequence number. 792</para> 793 794<para>XIDBASE: CARD32</para> 795 796<para> 797<!-- .LP --> 798The XIDBASE type is used to identify a particular client. Valid 799values are any existing resource identifier 800of any connected client, 801in which case the client 802that created the resource is specified, or the resource identifier 803base sent to the target client from the server in the connection setup 804reply. A value of 0 (zero) is valid when the XIDBASE is associated 805with device events that may not have been delivered to a client. 806</para> 807 808<para> 809CLIENTSPEC: XIDBASE or {<emphasis>CurrentClients</emphasis>, 810<emphasis>FutureClients</emphasis>, <emphasis>AllClients</emphasis>} 811</para> 812 813<para> 814The CLIENTSPEC type defines the set of clients the RC attributes are 815associated with. This type is used by recording clients when creating 816an RC or when changing RC attributes. XIDBASE specifies that the RC 817attributes apply to a single client only. 818<function>CurrentClients</function> 819specifies 820that the RC attributes apply to current client connections; 821<function>FutureClients</function> 822specifies future client connections; 823<function>AllClients</function> 824specifies all client connections, which includes current and future. 825</para> 826 827<para> 828The numeric values for 829<function>CurrentClients ,</function> 830<function>FutureClients</function> 831and 832<function>AllClients</function> 833are 834defined such that there will be no intersection with valid XIDBASEs. 835</para> 836 837<para> 838<!-- .LP --> 839When the context is enabled, the data connection is unregistered if it 840was registered. 841If the context is enabled, 842<function>CurrentClients</function> 843and 844<function>AllClients</function> 845silently exclude the recording data connection. 846It is an error to explicitly register the data connection. 847</para> 848 849<informaltable frame="none"> 850 <?dbfo keep-together="always" ?> 851 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 852 <colspec colname='c1' colwidth="1.0*"/> 853 <colspec colname='c2' colwidth="1.0*"/> 854 <colspec colname='c3' colwidth="3.0*"/> 855 <tbody> 856 <row> 857 <entry>CLIENT_INFO:</entry> 858 <entry>[client-resource:</entry> 859 <entry>CLIENTSPEC</entry> 860 </row> 861 <row> 862 <entry></entry> 863 <entry>intercepted-protocol:</entry> 864 <entry>LISTofRECORDRANGE]</entry> 865 </row> 866 </tbody> 867 </tgroup> 868</informaltable> 869 870<para> 871This structure specifies an intercepted client and the protocol to be 872intercepted for the client. The <emphasis remap='I'>client-resource</emphasis> field is a 873resource base that identifies the intercepted client. The 874<emphasis remap='I'>intercepted-protocol</emphasis> field specifies the protocol to intercept 875for the <emphasis remap='I'>client-resource</emphasis>. 876</para> 877</sect1> 878 879<sect1 id="Errors"> 880<title>Errors</title> 881<para> 882<emphasis role="bold">RecordContext</emphasis> 883</para> 884 885<itemizedlist> 886 <listitem> 887 <para> 888<!-- .IN RecordContext --> 889<!-- .br --> 890This error is returned if the value for an RC argument 891in a request does not name a defined record context. 892 </para> 893 </listitem> 894</itemizedlist> 895</sect1> 896</chapter> 897 898<chapter id="Protocol_Requests"> 899<title>Protocol Requests</title> 900<!-- .XS --> 901<!-- (SN Protocol Requests --> 902<!-- .XE --> 903<!-- .sp --> 904<para> 905<function>RecordQueryVersion</function> 906</para> 907 908<itemizedlist> 909 <listitem> 910 <para> 911<emphasis remap='I'>major-version</emphasis>, 912<emphasis remap='I'>minor-version</emphasis>: CARD16 913 </para> 914 </listitem> 915</itemizedlist> 916<para> 917-> 918</para> 919<itemizedlist> 920 <listitem> 921 <para> 922<emphasis remap='I'>major-version</emphasis>, 923<emphasis remap='I'>minor-version</emphasis>: CARD16 924 </para> 925 </listitem> 926</itemizedlist> 927 928<para> 929This request specifies the RECORD extension protocol version the client 930would like to use. When the specified protocol version is supported 931by the extension, the protocol version the server expects from the 932client is returned. Clients must use this request before other RECORD 933extension requests. 934</para> 935 936<para> 937This request also determines whether or not the RECORD extension protocol 938version specified by the client is supported by the extension. If the 939extension supports the version specified by the client, this version number 940should be returned. If the client has requested a higher version than is 941supported by the server, the server's highest version should be returned. 942Otherwise, if the client has requested a lower version than is supported 943by the server, the server's lowest version should be returned. This document 944defines major version one (1), 945minor version thirteen (13). 946</para> 947 948<para> 949<function>RecordCreateContext</function> 950</para> 951 952<informaltable frame="none"> 953 <?dbfo keep-together="always" ?> 954 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 955 <colspec colname='c1' colwidth="1.0*"/> 956 <tbody> 957 <row> 958 <entry> 959<emphasis remap='I'>context</emphasis>: RC 960 </entry> 961 </row> 962 <row> 963 <entry> 964<emphasis remap='I'>element-header</emphasis>: ELEMENT_HEADER 965 </entry> 966 </row> 967 <row> 968 <entry> 969<emphasis remap='I'>client-specifiers</emphasis>: LISTofCLIENTSPEC 970 </entry> 971 </row> 972 <row> 973 <entry> 974<emphasis remap='I'>ranges</emphasis>: LISTofRECORDRANGE 975 </entry> 976 </row> 977 <row> 978 <entry> 979Errors: 980<function>Match ,</function> 981<function>Value ,</function> 982<function>IDChoice ,</function> 983<function>Alloc</function> 984 </entry> 985 </row> 986 </tbody> 987 </tgroup> 988</informaltable> 989 990<para> 991This request creates a new 992record context 993within the server and assigns the identifier <emphasis remap='I'>context</emphasis> to 994it. After the <emphasis remap='I'>context</emphasis> is created, this request registers the 995set of clients in <emphasis remap='I'>client-specifiers</emphasis> with the <emphasis remap='I'>context</emphasis> and 996specifies the protocol to intercept for those clients. 997The recorded protocol elements will be preceded by data as specified 998by <emphasis remap='I'>element-header</emphasis>. 999Typically, 1000this request is used by a recording client over the control 1001connection. Multiple RC 1002objects can exist simultaneously, containing overlapping sets of 1003protocol and clients to intercept. 1004</para> 1005 1006<para> 1007If any of the values in 1008<emphasis remap='I'>element-header</emphasis> or 1009<emphasis remap='I'>ranges</emphasis> is invalid, a 1010<function>"Value"</function> 1011error results. Duplicate items in the list of <emphasis remap='I'>client-specifiers</emphasis> are 1012ignored. If any item in the <emphasis remap='I'>client-specifiers</emphasis> list is not a valid 1013CLIENTSPEC, a 1014<function>"Match"</function> 1015error results. Otherwise, each item in the <emphasis remap='I'>client-specifiers</emphasis> list is 1016processed as follows: 1017</para> 1018 1019<itemizedlist> 1020 <listitem> 1021 <para> 1022If the item is an XIDBASE identifying a particular client, the 1023specified client is registered with the <emphasis remap='I'>context</emphasis> and the protocol 1024to intercept for the client is then set to <emphasis remap='I'>ranges</emphasis>. 1025 </para> 1026 </listitem> 1027 <listitem> 1028 <para> 1029If the item is 1030<function>CurrentClients ,</function> 1031all existing clients are registered with the 1032<emphasis remap='I'>context</emphasis> at this time. 1033The protocol to intercept for all clients registered 1034with the <emphasis remap='I'>context</emphasis> is then set to <emphasis remap='I'>ranges</emphasis>. 1035 </para> 1036 </listitem> 1037 <listitem> 1038 <para> 1039If the item is 1040<function>FutureClients ,</function> 1041all clients that connect to the server 1042after this request executes will be automatically registered with the 1043<emphasis remap='I'>context</emphasis>. The protocol to intercept for such clients will be set to 1044<emphasis remap='I'>ranges</emphasis> in the <emphasis remap='I'>context</emphasis>. 1045 </para> 1046 </listitem> 1047 <listitem> 1048 <para> 1049If the item is 1050<function>AllClients ,</function> 1051the effect is as if the actions described 1052for 1053<function>FutureClients</function> 1054are performed, followed by the actions for 1055<function>CurrentClients .</function> 1056 </para> 1057 </listitem> 1058</itemizedlist> 1059 1060<para> 1061The 1062<function>"Alloc"</function> 1063error results when the server is unable to allocate the necessary 1064resources. 1065</para> 1066 1067<para> 1068<function>RecordRegisterClients</function> 1069</para> 1070 1071<informaltable frame="none"> 1072 <?dbfo keep-together="always" ?> 1073 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 1074 <colspec colname='c1' colwidth="1.0*"/> 1075 <tbody> 1076 <row> 1077 <entry> 1078<emphasis remap='I'>context</emphasis>: RC 1079 </entry> 1080 </row> 1081 <row> 1082 <entry> 1083<emphasis remap='I'>element-header</emphasis>: ELEMENT_HEADER 1084 </entry> 1085 </row> 1086 <row> 1087 <entry> 1088<emphasis remap='I'>client-specifiers</emphasis>: LISTofCLIENTSPEC 1089 </entry> 1090 </row> 1091 <row> 1092 <entry> 1093<emphasis remap='I'>ranges</emphasis>: LISTofRECORDRANGE 1094 </entry> 1095 </row> 1096 <row> 1097 <entry> 1098Errors: 1099<function>Match ,</function> 1100<function>Value ,</function> 1101<function>RecordContext ,</function> 1102<function>Alloc</function> 1103 </entry> 1104 </row> 1105 </tbody> 1106 </tgroup> 1107</informaltable> 1108 1109<para> 1110This request registers the set of clients in <emphasis remap='I'>client-specifiers</emphasis> with 1111the given <emphasis remap='I'>context</emphasis> and specifies the protocol to intercept for those 1112clients. 1113The header preceding each recorded protocol element is set as specified 1114by <emphasis remap='I'>element-header</emphasis>. 1115These flags affect the entire 1116context; their effect is not limited to the clients registered by 1117this request. 1118Typically, this request is used by a recording client over 1119the control connection. 1120</para> 1121 1122<para> 1123If <emphasis remap='I'>context</emphasis> does not name a valid RC, a 1124<function>"RecordContext"</function> 1125error results. If any of the values in 1126<emphasis remap='I'>element-header</emphasis> or <emphasis remap='I'>ranges</emphasis> is invalid, a 1127<function>"Value"</function> 1128error results. Duplicate items in the list of <emphasis remap='I'>client-specifiers</emphasis> are 1129ignored. If any item in the list of <emphasis remap='I'>client-specifiers</emphasis> is not a 1130valid CLIENTSPEC, a 1131<function>"Match"</function> 1132error results. 1133If the <emphasis remap='I'>context</emphasis> is enabled and the XID of the enabling connection 1134is specified, a 1135<function>"Match"</function> 1136error results. 1137Otherwise, each item in the <emphasis remap='I'>client-specifiers</emphasis> list is 1138processed as follows: 1139</para> 1140 1141<itemizedlist> 1142 <listitem> 1143 <para> 1144If the item is an XIDBASE identifying a particular client, the 1145specified client is registered with the <emphasis remap='I'>context</emphasis> if it is not already 1146registered. The protocol to intercept for the client is then set to 1147<emphasis remap='I'>ranges</emphasis>. 1148 </para> 1149 </listitem> 1150 <listitem> 1151 <para> 1152If the item is 1153<function>CurrentClients ,</function> 1154all existing clients that are not 1155already registered with the specified <emphasis remap='I'>context</emphasis>, 1156except the enabling connection if the <emphasis remap='I'>context</emphasis> is enabled, 1157are registered at this 1158time. The protocol to intercept for all clients registered with the 1159<emphasis remap='I'>context</emphasis> is then set to <emphasis remap='I'>ranges</emphasis>. 1160 </para> 1161 </listitem> 1162 <listitem> 1163 <para> 1164If the item is 1165<function>FutureClients ,</function> 1166all clients that connect to the server 1167after this request executes will be automatically registered with the 1168<emphasis remap='I'>context</emphasis>. The protocol to intercept for such clients will be set to 1169<emphasis remap='I'>ranges</emphasis> in the <emphasis remap='I'>context</emphasis>. 1170The set of clients that are registered with the 1171<emphasis remap='I'>context</emphasis> and their corresponding sets 1172of protocol to intercept are left intact. 1173 </para> 1174 </listitem> 1175 <listitem> 1176 <para> 1177If the item is 1178<function>AllClients ,</function> 1179the effect is as if the actions described 1180for 1181<function>FutureClients</function> 1182are performed, followed by the actions for 1183<function>CurrentClients .</function> 1184 </para> 1185 </listitem> 1186</itemizedlist> 1187<para> 1188The 1189<function>"Alloc"</function> 1190error results when the server is unable to allocate the necessary 1191resources. 1192</para> 1193 1194<para> 1195<function>RecordUnregisterClients</function> 1196</para> 1197 1198<informaltable frame="none"> 1199 <?dbfo keep-together="always" ?> 1200 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 1201 <colspec colname='c1' colwidth="1.0*"/> 1202 <tbody> 1203 <row> 1204 <entry> 1205<emphasis remap='I'>context</emphasis>: RC 1206 </entry> 1207 </row> 1208 <row> 1209 <entry> 1210<emphasis remap='I'>client-specifiers</emphasis>: LISTofCLIENTSPEC 1211 </entry> 1212 </row> 1213 <row> 1214 <entry> 1215Errors: 1216<function>Match ,</function> 1217<function>RecordContext</function> 1218 </entry> 1219 </row> 1220 </tbody> 1221 </tgroup> 1222</informaltable> 1223 1224 1225<para> 1226This request removes the set of clients in <emphasis remap='I'>client-specifiers</emphasis> from the 1227given <emphasis remap='I'>context</emphasis>'s set of registered clients. Typically, this request is 1228used by a recording client over the control connection. 1229</para> 1230 1231<para> 1232If <emphasis remap='I'>context</emphasis> does not name a valid RC, a 1233<function>"RecordContext"</function> 1234error results. Duplicate items in the list of <emphasis remap='I'>client-specifiers</emphasis> are 1235ignored. If any item in the list is not a valid CLIENTSPEC, a 1236<function>"Match"</function> 1237error results. Otherwise, each item in the <emphasis remap='I'>client-specifiers</emphasis> list is 1238processed as follows: 1239</para> 1240 1241<itemizedlist> 1242 <listitem> 1243 <para> 1244If the item is an XIDBASE identifying a particular client, and the 1245specified client is currently registered with the <emphasis remap='I'>context</emphasis>, it is 1246unregistered, and the set of protocol to intercept for the client is 1247deleted from the <emphasis remap='I'>context</emphasis>. If the specified client is not registered 1248with the <emphasis remap='I'>context</emphasis>, the item has no effect. 1249 </para> 1250 </listitem> 1251 <listitem> 1252 <para> 1253If the item is 1254<function>CurrentClients ,</function> 1255all clients currently registered with 1256the <emphasis remap='I'>context</emphasis> are unregistered from it, and their corresponding sets of 1257protocol to intercept are deleted from the <emphasis remap='I'>context</emphasis>. 1258 </para> 1259 </listitem> 1260 <listitem> 1261 <para> 1262If the item is 1263<function>FutureClients ,</function> 1264clients that connect to the server after 1265this request executes will not automatically be registered with the 1266<emphasis remap='I'>context</emphasis>. The set of clients that are registered with this context 1267and their corresponding sets of protocol that will be 1268intercepted are left intact. 1269 </para> 1270 </listitem> 1271 <listitem> 1272 <para> 1273If the item is 1274<function>AllClients ,</function> 1275the effect is as if the actions described 1276for 1277<function>FutureClients</function> 1278are performed, followed by the actions for 1279<function>CurrentClients .</function> 1280 </para> 1281 </listitem> 1282</itemizedlist> 1283 1284<para> 1285A client is unregistered automatically when it disconnects. 1286</para> 1287 1288<para> 1289<function>RecordGetContext</function> 1290</para> 1291 1292<informaltable frame="none"> 1293 <?dbfo keep-together="always" ?> 1294 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 1295 <colspec colname='c1' colwidth="1.0*"/> 1296 <tbody> 1297 <row> 1298 <entry> 1299<emphasis remap='I'>context</emphasis>: RC 1300 </entry> 1301 </row> 1302 <row> 1303 <entry> 1304-> 1305 </entry> 1306 </row> 1307 <row> 1308 <entry> 1309<emphasis remap='I'>enabled</emphasis>: BOOL 1310 </entry> 1311 </row> 1312 <row> 1313 <entry> 1314<emphasis remap='I'>element-header</emphasis>: ELEMENT_HEADER 1315 </entry> 1316 </row> 1317 <row> 1318 <entry> 1319<emphasis remap='I'>intercepted-clients</emphasis>: LISTofCLIENT_INFO 1320 </entry> 1321 </row> 1322 <row> 1323 <entry> 1324Errors: 1325 </entry> 1326 </row> 1327 <row> 1328 <entry> 1329<function>RecordContext</function> 1330 </entry> 1331 </row> 1332 </tbody> 1333 </tgroup> 1334</informaltable> 1335 1336<para> 1337This request queries the current state of the specified <emphasis remap='I'>context</emphasis> 1338and is typically used by a recording client over the control connection. 1339The <emphasis remap='I'>enabled</emphasis> field 1340specifies the state of data transfer between the extension and the 1341recording client, and is either enabled 1342<function>( True )</function> 1343or disabled 1344<function>( False ).</function> 1345The initial state is disabled. 1346When enabled, all core X protocol and 1347extension protocol received from (requests) or sent to (replies, 1348errors, events) a particular client, and requested to be intercepted 1349by the recording client, is reported to the recording client over the 1350data connection. 1351The <emphasis remap='I'>element-header</emphasis> specifies the header that precedes each 1352recorded protocol element. 1353The 1354<emphasis remap='I'>intercepted-clients</emphasis> field specifies the list of clients currently 1355being recorded and the protocol associated with each client. 1356If future clients will be automatically registered with the context, 1357one of the returned CLIENT_INFO structures has a <emphasis remap='I'>client-resource</emphasis> value 1358of FutureClients and an <emphasis remap='I'>intercepted-protocol</emphasis> giving the protocol to 1359intercept for future clients. 1360Protocol ranges may be decomposed, coalesced, or otherwise modified 1361by the server from how they were specified by the client. 1362All CLIENTSPECs registered with the server are returned, even if the 1363RECORDRANGE(s) associated with them specify no protocol to record. 1364</para> 1365 1366<para> 1367When the <emphasis remap='I'>context</emphasis> argument is not valid, a 1368<function>RecordContext</function> 1369error results. 1370</para> 1371 1372<para> 1373<function>RecordEnableContext</function> 1374</para> 1375 1376<informaltable frame="none"> 1377 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 1378 <colspec colname='c1' colwidth="1.0*"/> 1379 <tbody> 1380 <row> 1381 <entry> 1382<emphasis remap='I'>context</emphasis>: RC 1383 </entry> 1384 </row> 1385 <row> 1386 <entry> 1387->+ 1388 </entry> 1389 </row> 1390 <row> 1391 <entry> 1392<emphasis remap='I'>category</emphasis>: 1393{<function>FromServer</function>, <function>FromClient</function>, 1394<function>ClientStarted</function>, <function>ClientDied</function>, 1395<function>StartOfData</function>, 1396<function>EndOfData</function>} 1397 </entry> 1398 </row> 1399 1400 <row> 1401 <entry> 1402<emphasis remap='I'>element-header</emphasis>: ELEMENT_HEADER 1403 </entry> 1404 </row> 1405 <row> 1406 <entry> 1407<emphasis remap='I'>client-swapped</emphasis>: BOOL 1408 </entry> 1409 </row> 1410 <row> 1411 <entry> 1412<emphasis remap='I'>id-base</emphasis>: XIDBASE 1413 </entry> 1414 </row> 1415 <row> 1416 <entry> 1417<emphasis remap='I'>server-time</emphasis>: TIMESTAMP 1418 </entry> 1419 </row> 1420 <row> 1421 <entry> 1422<emphasis remap='I'>recorded-sequence-number</emphasis>: CARD32 1423 </entry> 1424 </row> 1425 <row> 1426 <entry> 1427<emphasis remap='I'>data</emphasis>: LISTofBYTE 1428 </entry> 1429 </row> 1430 <row> 1431 <entry> 1432Errors: 1433<function>Match</function>, 1434<function>RecordContext</function> 1435 </entry> 1436 </row> 1437 </tbody> 1438 </tgroup> 1439</informaltable> 1440 1441<para> 1442This request enables data transfer between the recording client 1443and the extension and returns the protocol data the recording client 1444has previously expressed interest in. Typically, this request is 1445executed by the recording client over the data connection. 1446</para> 1447 1448<para> 1449If the client is registered on the <emphasis remap='I'>context</emphasis>, it is unregistered 1450before any recording begins. 1451</para> 1452<para> 1453<!-- .LP --> 1454Once the server receives this request, it begins intercepting 1455and reporting to the recording client all core and extension protocol 1456received from or sent to clients registered with the RC that the 1457recording client has expressed interest in. All intercepted protocol data 1458is returned in the byte-order of the recorded client. Therefore, 1459recording clients are responsible for all byte swapping, if required. 1460More than one recording client cannot enable data transfer on the 1461same RC at the same time. Multiple intercepted requests, replies, 1462events and errors might be packaged into a single reply before 1463being returned to the recording clients. 1464</para> 1465<para> 1466<!-- .LP --> 1467The 1468<emphasis remap='I'>category</emphasis> field determines the possible 1469types of the data. 1470When a context is enabled, the server will immediately send a reply of 1471category 1472<function>StartOfData</function> 1473to notify the client that recording is enabled. 1474A category of 1475<function>FromClient</function> 1476means the data are from the client 1477(requests); 1478<function>FromServer</function> 1479means data are from the server (replies, 1480errors, events, or device events). 1481For a new client, the category is 1482<function>ClientStarted</function> 1483and the data are the connection setup reply. 1484When 1485the recorded client connection is closed, <emphasis remap='I'>category</emphasis> is 1486set to the value 1487<function>ClientDied</function> 1488and no protocol is included in this reply. 1489When the disable request is made over the control connection, 1490a final reply is sent over the data connection with category 1491<function>EndOfData</function> 1492and no protocol. 1493</para> 1494<para> 1495<!-- .LP --> 1496The <emphasis remap='I'>element-header</emphasis> field returns the value currently set for the 1497context, which tells what header information precedes each recorded 1498protocol element in this reply. 1499</para> 1500<para> 1501<!-- .LP --> 1502The <emphasis remap='I'>client-swapped</emphasis> field is 1503<function>True</function> 1504if the byte order of 1505the protocol being recorded 1506is swapped 1507relative to the recording client; 1508otherwise, <emphasis remap='I'>client-swapped</emphasis> is 1509<function>False .</function> 1510The recorded protocol 1511is in the byte order of the client being 1512recorded; device events are in the byte order of the 1513recording client. 1514For replies of category 1515<function>StartOfData</function> 1516and 1517<function>EndOfData</function> 1518the 1519<emphasis remap='I'>client-swapped</emphasis> bit is set 1520according 1521to the byte order of the server relative to the recording client. 1522The <emphasis remap='I'>id-base</emphasis> field is the resource identifier base 1523sent to the client from the server in the 1524connection setup reply, and hence, identifies the client being 1525recorded. The <emphasis remap='I'>id-base</emphasis> field is 0 (zero) when the protocol 1526data being 1527returned are device events. 1528The <emphasis remap='I'>server-time</emphasis> field is set to the time of the 1529server when the first protocol element in this reply was intercepted. 1530The <emphasis remap='I'>server-time</emphasis> 1531of reply N+1 is greater than or equal to the <emphasis remap='I'>server-time</emphasis> of reply N, 1532and is greater than or equal to the time of the last protocol 1533element in reply N. 1534</para> 1535<para> 1536<!-- .LP --> 1537The <emphasis remap='I'>recorded-sequence-number</emphasis> field is set to the sequence number 1538of the recorded client's most recent request processed by the server. 1539</para> 1540<para> 1541<!-- .LP --> 1542The <emphasis remap='I'>data</emphasis> field 1543contains the raw protocol data being returned to the recording client. 1544If requested by the <emphasis remap='I'>element-header</emphasis> of this record context, each 1545protocol element may be preceded by a 32-bit timestamp and/or 1546a 32-bit sequence number. 1547If present, both the timestamp and sequence number are always in the 1548byte order of the recording client. 1549</para> 1550<para> 1551<!-- .LP --> 1552For the core X events 1553<function>KeyPress ,</function> 1554<function>KeyRelease ,</function> 1555<function>ButtonPress ,</function> 1556and 1557<function>ButtonRelease ,</function> 1558the fields of a device event that contain 1559valid information are <emphasis remap='I'>time</emphasis> and <emphasis remap='I'>detail</emphasis>. 1560For the core X event 1561<function>MotionNotify ,</function> 1562the fields of a device event that contain 1563valid information are <emphasis remap='I'>time</emphasis>, <emphasis remap='I'>root</emphasis>, 1564<emphasis remap='I'>root-x</emphasis> and <emphasis remap='I'>root-y</emphasis>. 1565The <emphasis remap='I'>time</emphasis> field refers to the time the event was generated by the 1566device. 1567</para> 1568<para> 1569<!-- .LP --> 1570For the extension input device events 1571<function>DeviceKeyPress ,</function> 1572<function>DeviceKeyRelease ,</function> 1573<function>DeviceButtonPress ,</function> 1574and 1575<function>DeviceButtonRelease ,</function> 1576the fields of a device event that contain valid information are 1577<emphasis remap='I'>device</emphasis>, <emphasis remap='I'>time</emphasis> and <emphasis remap='I'>detail</emphasis>. 1578For 1579<function>DeviceMotionNotify ,</function> 1580the valid device event fields are 1581<emphasis remap='I'>device</emphasis> and <emphasis remap='I'>time</emphasis>. 1582For the extension input device events 1583<function>ProximityIn</function> 1584and 1585<function>ProximityOut ,</function> 1586the fields of a device event that contain valid 1587information are <emphasis remap='I'>device</emphasis> and <emphasis remap='I'>time</emphasis>. 1588For the extension input device event 1589<function>DeviceValuator ,</function> 1590the fields of a device event that contain valid information are 1591<emphasis remap='I'>device</emphasis>, 1592<emphasis remap='I'>num_valuators</emphasis>, <emphasis remap='I'>first_valuator</emphasis>, and <emphasis remap='I'>valuators</emphasis>. 1593The <emphasis remap='I'>time</emphasis> field refers to the time the event was generated by the 1594device. 1595</para> 1596<para> 1597<!-- .LP --> 1598The error 1599<function>"Match"</function> 1600is returned when data transfer is already enabled. 1601When the <emphasis remap='I'>context</emphasis> argument is not valid, a 1602<function>RecordContext</function> 1603error results. 1604</para> 1605 1606<para> 1607<function>RecordDisableContext</function> 1608</para> 1609 1610<informaltable frame="none"> 1611 <?dbfo keep-together="always" ?> 1612 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 1613 <colspec colname='c1' colwidth="1.0*"/> 1614 <tbody> 1615 <row> 1616 <entry> 1617<emphasis remap='I'>context</emphasis>: RC 1618 </entry> 1619 </row> 1620 <row> 1621 <entry> 1622Errors: 1623<function>RecordContext</function> 1624 </entry> 1625 </row> 1626 </tbody> 1627 </tgroup> 1628</informaltable> 1629 1630<para> 1631This request is typically executed by the recording client over the 1632control connection. This request directs the extension to immediately 1633send any complete protocol elements currently buffered, 1634to send a final reply with category 1635<function>EndOfData ,</function> 1636and to discontinue 1637data transfer between the extension and the recording client. 1638Protocol reporting is disabled 1639on the data connection that is currently enabled for the given 1640<emphasis remap='I'>context</emphasis>. Once the extension completes 1641processing this request, no additional recorded protocol will 1642be reported to the recording client. If a data connection is not 1643currently enabled when this request is executed, then this request has 1644no affect on the state of data transfer. 1645An RC is disabled automatically when the connection to the enabling 1646client is closed down. 1647</para> 1648 1649<para> 1650When the <emphasis remap='I'>context</emphasis> argument is not valid, a 1651<function>RecordContext</function> 1652error results. 1653</para> 1654 1655<para> 1656<function>RecordFreeContext</function> 1657</para> 1658 1659<itemizedlist> 1660 <listitem> 1661 <para> 1662<emphasis remap='I'>context</emphasis> RC 1663<!-- .br --> 1664 </para> 1665 </listitem> 1666 <listitem> 1667 <para> 1668Errors: 1669<function>RecordContext</function> 1670 </para> 1671 </listitem> 1672</itemizedlist> 1673 1674<para> 1675This request deletes the association between the resource ID and the 1676RC and destroys the RC. 1677If a client has enabled data transfer on this <emphasis remap='I'>context</emphasis>, the actions 1678described in 1679<function>RecordDisableContext</function> 1680are performed before the <emphasis remap='I'>context</emphasis> 1681is freed. 1682</para> 1683 1684<para> 1685An RC is destroyed automatically when the connection to the creating client 1686is closed down and the close-down mode is <function>DestroyAll</function>. When the 1687<emphasis remap='I'>context</emphasis> argument is not valid, a 1688<function>RecordContext</function> 1689error results. 1690</para> 1691</chapter> 1692 1693<chapter id="Encoding"> 1694<title>Encoding</title> 1695<para> 1696Please refer to the X11 Protocol Encoding document as this document uses 1697conventions established there. 1698</para> 1699 1700<para> 1701The name of this extension is "RECORD". 1702</para> 1703 1704<sect1 id="Types_2"> 1705<title>Types</title> 1706<para> 1707RC: CARD32 1708</para> 1709 1710<literallayout class="monospaced"> 1711RANGE8 1712 1 CARD8 first 1713 1 CARD8 last 1714</literallayout> 1715 1716<literallayout class="monospaced"> 1717RANGE16 1718 2 CARD16 first 1719 2 CARD16 last 1720</literallayout> 1721 1722<literallayout class="monospaced"> 1723EXTRANGE 1724 2 RANGE8 major 1725 4 RANGE16 minor 1726</literallayout> 1727 1728<literallayout class="monospaced"> 1729RECORDRANGE 1730 2 RANGE8 core-requests 1731 2 RANGE8 core-replies 1732 6 EXTRANGE ext-requests 1733 6 EXTRANGE ext-replies 1734 2 RANGE8 delivered-events 1735 2 RANGE8 device-events 1736 2 RANGE8 errors 1737 1 BOOL client-started 1738 1 BOOL client-died 1739</literallayout> 1740 1741<literallayout class="monospaced"> 1742ELEMENT_HEADER 1743 1 CARD8 1744 0x01 from-server-time 1745 0x02 from-client-time 1746 0x04 from-client-sequence 1747</literallayout> 1748 1749<para> 1750XIDBASE: CARD32 1751</para> 1752 1753<literallayout class="monospaced"> 1754CLIENTSPEC 1755 4 XIDBASE client-id-base 1756 1 CurrentClients 1757 2 FutureClients 1758 3 AllClients 1759</literallayout> 1760 1761<literallayout class="monospaced"> 1762CLIENT_INFO 1763 4 CLIENTSPEC client-resource 1764 4 CARD32 n, number of record ranges in 1765 intercepted-protocol 1766 24n LISTofRECORDRANGE intercepted-protocol 1767</literallayout> 1768 1769</sect1> 1770<sect1 id="Errors_2"> 1771<title>Errors</title> 1772 1773<literallayout class="monospaced"> 1774<function>RecordContext</function> 1775 1 0 Error 1776 1 CARD8 extension's base error code + 0 1777 2 CARD16 sequence number 1778 4 CARD32 invalid record context 1779 24 unused 1780</literallayout> 1781</sect1> 1782 1783<sect1 id="Requests"> 1784<title>Requests</title> 1785 1786<literallayout class="monospaced"> 1787<function>RecordQueryVersion</function> 1788 1 CARD8 major opcode 1789 1 0 minor opcode 1790 2 2 request length 1791 2 CARD16 major version 1792 2 CARD16 minor version 1793 => 1794 1 1 Reply 1795 1 unused 1796 2 CARD16 sequence number 1797 4 0 reply length 1798 2 CARD16 major version 1799 2 CARD16 minor version 1800 20 unused 1801</literallayout> 1802 1803<literallayout class="monospaced"> 1804<function>RecordCreateContext</function> 1805 1 CARD8 major opcode 1806 1 1 minor opcode 1807 2 5+m+6n request length 1808 4 RC context 1809 1 ELEMENT_HEADER element-header 1810 3 unused 1811 4 CARD32 m, number of client-specifiers 1812 4 CARD32 n, number of ranges 1813 4m LISTofCLIENTSPEC client-specifiers 1814 24n LISTofRECORDRANGE ranges 1815</literallayout> 1816 1817<literallayout class="monospaced"> 1818<function>RecordRegisterClients</function> 1819 1 CARD8 major opcode 1820 1 2 minor opcode 1821 2 5+m+6n request length 1822 4 RC context 1823 1 ELEMENT_HEADER element-header 1824 3 unused 1825 4 CARD32 m, number of client-specifiers 1826 4 CARD32 n, number of ranges 1827 4m LISTofCLIENTSPEC client-specifiers 1828 24n LISTofRECORDRANGE ranges 1829</literallayout> 1830 1831<literallayout class="monospaced"> 1832<function>RecordUnregisterClients</function> 1833 1 CARD8 major opcode 1834 1 3 minor opcode 1835 2 3+m request length 1836 4 RC context 1837 4 CARD32 m, number of client-specifiers 1838 4m LISTofCLIENTSPEC client-specifiers 1839</literallayout> 1840 1841<literallayout class="monospaced"> 1842<function>RecordGetContext</function> 1843 1 CARD8 major opcode 1844 1 4 minor opcode 1845 2 2 request length 1846 4 RC context 1847 => 1848 1 1 Reply 1849 1 BOOL enabled 1850 2 CARD16 sequence number 1851 4 j reply length 1852 1 ELEMENT_HEADER element-header 1853 3 unused 1854 4 CARD32 n, number of intercepted-clients 1855 16 unused 1856 4j LISTofCLIENT_INFO intercepted-clients 1857</literallayout> 1858 1859<literallayout class="monospaced"> 1860<function>RecordEnableContext</function> 1861 1 CARD8 major opcode 1862 1 5 minor opcode 1863 2 2 request length 1864 4 RC context 1865 =>+ 1866 1 1 Reply 1867 1 category 1868 0 FromServer 1869 1 FromClient 1870 2 ClientStarted 1871 3 ClientDied 1872 4 StartOfData 1873 5 EndOfData 1874 2 CARD16 sequence number 1875 4 n reply length 1876 1 ELEMENT_HEADER element-header 1877 1 BOOL client-swapped 1878 2 unused 1879 4 XIDBASE id-base 1880 4 TIMESTAMP server-time 1881 4 CARD32 recorded-sequence-number 1882 8 unused 1883 4n BYTE data 1884</literallayout> 1885 1886<literallayout class="monospaced"> 1887<function>RecordDisableContext</function> 1888 1 CARD8 major opcode 1889 1 6 minor opcode 1890 2 2 request length 1891 4 RC context 1892</literallayout> 1893 1894<literallayout class="monospaced"> 1895<function>RecordFreeContext</function> 1896 1 CARD8 major opcode 1897 1 7 minor opcode 1898 2 2 request length 1899 4 RC context 1900</literallayout> 1901 1902</sect1> 1903</chapter> 1904</book> 1905