home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 45 / cda45.iso / Linux / XFree86-4.0 / doc / record.TXT < prev    next >
Encoding:
Text File  |  2000-03-09  |  39.8 KB  |  1,387 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.       Record Extension Protocol Specification
  17.  
  18.             Version 1.13
  19.  
  20.            X Consortium Standard
  21.  
  22.          X Version 11, Release 6.4
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.             Martha Zimet
  30.           Network Computing Devices, Inc.
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.              edited by
  38.                Stephen Gildea
  39.             X Consortium
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88. Copyright (C) 1994 Network Computing Devices, Inc.
  89.  
  90. Permission to use, copy, modify, distribute, and sell this
  91. documentation for any purpose is hereby granted without fee,
  92. provided that the above copyright notice and this permission
  93. notice appear in all copies.  Network Computing Devices,
  94. Inc.  makes no representations about the suitability for any
  95. purpose of the information in this document.  This documen-
  96. tation is provided "as is" without express or implied war-
  97. ranty.
  98.  
  99. Copyright (C) 1994, 1995  X Consortium
  100.  
  101. Permission is hereby granted, free of charge, to any person
  102. obtaining a copy of this software and associated documenta-
  103. tion files (the "Software"), to deal in the Software without
  104. restriction, including without limitation the rights to use,
  105. copy, modify, merge, publish, distribute, sublicense, and/or
  106. sell copies of the Software, and to permit persons to whom
  107. the Software is furnished to do so, subject to the following
  108. conditions:
  109.  
  110. The above copyright notice and this permission notice shall
  111. be included in all copies or substantial portions of the
  112. Software.
  113.  
  114. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  115. KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  116. WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PUR-
  117. POSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE X CONSOR-
  118. TIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  119. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  120. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  121. OR OTHER DEALINGS IN THE SOFTWARE.
  122.  
  123. Except as contained in this notice, the name of the X Con-
  124. sortium and shall not be used in advertising or otherwise to
  125. promote the sale, use or other dealings in this Software
  126. without prior written authorization from the X Consortium.
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. X11, Release 6.4      Record Extension Protocol, Version 1.13
  137.  
  138.  
  139. 1.  Introduction
  140.  
  141. Several proposals have been written over the past few years that
  142. address some of the issues surrounding the recording and playback
  143. of user actions in the X Window System1:
  144.  
  145. o  Some Proposals for a Minimal X11 Testing Extension, Kieron
  146.    Drake, UniSoft Ltd., April 1991
  147.  
  148. o  X11 Input Synthesis Extension Proposal, Larry Woestman,
  149.    Hewlett Packard, November 1991
  150.  
  151. o  XTrap Architecture, Dick Annicchiario, et al, Digital Equip-
  152.    ment Corporation, July 1991
  153.  
  154. o  XTest Extension Recording Specification, Yochanan Slonim, Mer-
  155.    cury Interactive, December 1992
  156.  
  157. This document both unifies and extends the previous diverse
  158. approaches to generate a proposal for an X extension that pro-
  159. vides support for the recording of all core X protocol and arbi-
  160. trary extension protocol.  Input synthesis, or playback, has
  161. already been implemented in the XTest extension, an X Consortium
  162. standard.  Therefore, this extension is limited to recording.
  163.  
  164. In order to provide both record and playback functionality, a
  165. hypothetical record application could use this extension to cap-
  166. ture both user actions and their consequences.    For example, a
  167. button press (a user action) may cause a window to be mapped and
  168. a corresponding MapNotify event to be sent (a consequence).  This
  169. information could be stored for later use by a playback applica-
  170. tion.
  171.  
  172. The playback application could use the recorded actions as input
  173. for the XTest extension's XTestFakeInput operation to synthesize
  174. the appropriate input events.  The "consequence" or synchroniza-
  175. tion information is then used as a synchronization point during
  176. playback.  That is, the playback application does not generate
  177. specific synthesized events until their matching synchronization
  178. condition occurs.  When the condition occurs the processing of
  179. synthesized events continues.  Determination that the condition
  180. has occurred may be made by capturing the consequences of the
  181. synthesized events and comparing them to the previously recorded
  182. synchronization information.  For example, if a button press was
  183. followed by a MapNotify event on a particular window in the
  184. recorded data, the playback application might synthesize the but-
  185. ton press then wait for the MapNotify event on the appropriate
  186. window before proceeding with subsequent synthesized input.
  187.  
  188. Because it is impossible to predict what synchronization informa-
  189. tion will be required by a particular application, the extension
  190. provides facilities to record any subset of core X protocol and
  191. -----------
  192.   1 X Window System is a trademark of X Consortium, Inc.
  193.  
  194.  
  195.  
  196.                 1
  197.  
  198.  
  199.  
  200.  
  201.  
  202. Record Extension Protocol, Version 1.13      X11, Release 6.4
  203.  
  204.  
  205. arbitrary extension protocol.  As such, this extension does not
  206. enforce a specific synchronization methodology; any method based
  207. on information in the X protocol stream (e.g., watching for win-
  208. dow mapping/unmapping, cursor changes, drawing of certain text
  209. strings, etc.) can capture the information it needs using RECORD
  210. facilities.
  211.  
  212. 1.1.  Acknowledgements
  213.  
  214. The document represents the culmination of two years of debate
  215. and experiments done under the auspices of the X Consortium xtest
  216. working group.    Although this was a group effort, the author
  217. remains responsible for any errors or omissions.  Two years ago,
  218. Robert Chesler of Absol-puter, Kieron Drake of UniSoft Ltd., Marc
  219. Evans of Synergytics and Ken Miller of Digitial shared the vision
  220. of a standard extension for recording and were all instrumental
  221. in the early protocol development.  During the last two years,
  222. Bob Scheifler of the X Consortium and Jim Fulton of NCD continu-
  223. ously provided input to the protocol design, as well as encour-
  224. agement to the author.    In the last few months, Stephen Gildea
  225. and Dave Wiggins, both X Consortium staff, have spent consider-
  226. able time fine tuning the protocol design and reviewing the pro-
  227. tocol specifications.  Most recently, Amnon Cohen of Mercury
  228. Interactive has assisted in clarification of the recorded event
  229. policy, and Kent Siefkes of Performance Awareness has assisted in
  230. clarification of the timestamp policy.
  231.  
  232. 1.2.  Goals
  233.  
  234.  
  235.      o    To provide a standard for recording, whereby both device
  236.     events and synchronization information in the form of
  237.     device event consequences are recorded.
  238.  
  239.      o    To record contextual information used in synchronized
  240.     playback without prior knowledge of the application that
  241.     is being recorded.
  242.  
  243.      o    To provide the ability to record arbitrary X protocol
  244.     extensions.
  245.  
  246. 1.3.  Requirements
  247.  
  248. The extension should function as follows:
  249.  
  250.      o    It should not be dependent on other clients or extensions
  251.     for its operation.
  252.  
  253.      o    It should not significantly impact performance.
  254.  
  255.      o    It should support the recording of all device input (core
  256.     devices and XInput devices).
  257.  
  258.  
  259.  
  260.  
  261.  
  262.                 2
  263.  
  264.  
  265.  
  266.  
  267.  
  268. X11, Release 6.4      Record Extension Protocol, Version 1.13
  269.  
  270.  
  271.      o    It should be extendible.
  272.  
  273.      o    It should support the recording of synchronization infor-
  274.     mation for user events.
  275.  
  276.  
  277. 2.  Design
  278.  
  279. This section gives an overview of the RECORD extension and dis-
  280. cusses its overall operation and data types.
  281.  
  282.  
  283. 2.1.  Overview
  284.  
  285. The mechanism used by this extension for recording is to inter-
  286. cept core X protocol and arbitrary X extension protocol entirely
  287. within the X server itself.  When the extension has been
  288. requested to intercept specific protocol by one or more clients,
  289. the protocol data are formatted and returned to the recording
  290. clients.
  291.  
  292. The extension provides a mechanism for capturing all events,
  293. including input device events that go to no clients, that is
  294. analogous to a client expressing "interest" in all events in all
  295. windows, including the root window.  Event filtering in the
  296. extension provides a mechanism for feeding device events to
  297. recording clients; it does not provide a mechanism for in-place,
  298. synchronous event substitution, modification, or withholding.  In
  299. addition, the extension does not provide data compression before
  300. intercepted protocol is returned to the recording clients.
  301.  
  302. 2.1.1.    Data Delivery
  303.  
  304. Because events are limited in size to 32 bytes, using events to
  305. return intercepted protocol data to recording clients is pro-
  306. hibitive in terms of performance.  Therefore, intercepted proto-
  307. col data are returned to recording clients through multiple
  308. replies to the extension request to begin protocol interception
  309. and reporting.    This utilization is consistent with
  310. ListFontsWithInfo, for example, where a single request has multi-
  311. ple replies.
  312.  
  313. Individual requests, replies, events or errors intercepted by the
  314. extension on behalf of recording clients cannot be split across
  315. reply packets.    In order to reduce overhead, multiple intercepted
  316. requests, replies, events and errors might be collected into a
  317. single reply.  Nevertheless, all data are returned to the client
  318. in a timely manner.
  319.  
  320. 2.1.2.    Record Context
  321.  
  322. The extension adds a record context resource (RC) to the set of
  323. resources managed by the server.  All the extension operations
  324. take an RC as an argument.  Although the protocol permits sharing
  325.  
  326.  
  327.  
  328.                 3
  329.  
  330.  
  331.  
  332.  
  333.  
  334. Record Extension Protocol, Version 1.13      X11, Release 6.4
  335.  
  336.  
  337. of RCs between clients, it is expected that clients will use
  338. their own RCs.    The attributes used in extension operations are
  339. stored in the RCs, and these attributes include the protocol and
  340. clients to intercept.
  341.  
  342. The terms "register" and "unregister" are used to describe the
  343. relationship between clients to intercept and the RC.  To regis-
  344. ter a client with an RC means the client is added to the list of
  345. clients to intercept; to unregister a client means the client is
  346. deleted from the list of clients to intercept.    When the server
  347. is requested to register or unregister clients from an RC, it is
  348. required to do so immediately.    That is, it is not permissible
  349. for the server to wait until recording is enabled to register
  350. clients or recording is disabled to unregister clients.
  351.  
  352. 2.1.3.    Record Client Connections
  353.  
  354. The typical communication model for a recording client is to open
  355. two connections to the server and use one for RC control and the
  356. other for reading protocol data.
  357.  
  358. The "control" connection can execute requests to obtain informa-
  359. tion about the supported protocol version, create and destroy
  360. RCs, specify protocol types to intercept and clients to be
  361. recorded, query the current state of an RC, and to stop intercep-
  362. tion and reporting of protocol data.  The "data" connection can
  363. execute a request to enable interception and reporting of speci-
  364. fied protocol for a particular RC.  When the "enable" request is
  365. issued, intercepted protocol is sent back on the same connection,
  366. generally in more than one reply packet.  Until the last reply to
  367. the "enable" request is sent by the server, signifying that the
  368. request execution is complete, no other requests will be executed
  369. by the server on that connection.  That is, the connection that
  370. data are being reported on cannot issue the "disable" request
  371. until the last reply to the "enable" request is sent by the
  372. server.  Therefore, unless a recording client never has the need
  373. to disable the interception and reporting of protocol data, two
  374. client connections are necessary.
  375.  
  376. 2.1.4.    Events
  377.  
  378. The terms "delivered events" and "device events" are used to
  379. describe the two event classes recording clients may select for
  380. interception.  These event classes are handled differently by the
  381. extension.  Delivered events are core X events or X extension
  382. events the server actually delivers to one or more clients.
  383. Device events are events generated by core X devices or extension
  384. input devices that the server may or may not deliver to any
  385. clients.  When device events are selected for interception by a
  386. recording client, the extension guarantees each device event is
  387. recorded and will be forwarded to the recording client in the
  388. same order it is generated by the device.
  389.  
  390.  
  391.  
  392.  
  393.  
  394.                 4
  395.  
  396.  
  397.  
  398.  
  399.  
  400. X11, Release 6.4      Record Extension Protocol, Version 1.13
  401.  
  402.  
  403. The recording of selected device events is not affected by server
  404. grabs.    Delivered events, on the other hand, can be affected by
  405. server grabs.  If a recording client selects both a device event
  406. and delivered events that result from that device event, the
  407. delivered events are recorded after the device event.  In the
  408. absence of grabs, the delivered events for a device event precede
  409. later device events.
  410.  
  411. Requests that have side effects on devices, such as WarpPointer
  412. and GrabPointer with a confine-to window, will cause RECORD to
  413. record an associated device event.  The XTEST extension request
  414. XTestFakeInput causes a device event to be recorded; the device
  415. events are recorded in the same order that the XTestFakeInput
  416. requests are received by the server.
  417.  
  418. If a key autorepeats, multiple KeyPress and KeyRelease device
  419. events are reported.
  420.  
  421. 2.1.5.    Timing
  422.  
  423. Requests are recorded just before they are executed; the time
  424. associated with a request is the server time when it is recorded.
  425.  
  426.  
  427. 2.2.  Types
  428.  
  429.  
  430. The following new types are used in the request definitions that
  431. appear in section 3.
  432.  
  433.  
  434. RC:   CARD32
  435.  
  436.  
  437. The RC type is a resource identifier for a server record context.
  438.  
  439.  
  440. RANGE8:     [first, last:   CARD8]
  441. RANGE16:    [first, last:   CARD16]
  442. EXTRANGE:   [major:        RANGE8
  443.         minor:        RANGE16]
  444.  
  445.  
  446.  
  447. RECORDRANGE:   [core-requests:       RANGE8
  448.            core-replies:       RANGE8
  449.            ext-requests:       EXTRANGE
  450.            ext-replies:       EXTRANGE
  451.            delivered-events:   RANGE8
  452.            device-events:       RANGE8
  453.            errors:           RANGE8
  454.            client-started:       BOOL
  455.            client-died:       BOOL]
  456.  
  457.  
  458.  
  459.  
  460.                 5
  461.  
  462.  
  463.  
  464.  
  465.  
  466. Record Extension Protocol, Version 1.13      X11, Release 6.4
  467.  
  468.  
  469. The RECORDRANGE structure contains the protocol values to inter-
  470. cept.  Typically, this structure is sent by recording clients
  471. over the control connection when creating or modifying an RC.
  472.  
  473. core-requests
  474.      Specifies core X protocol requests with an opcode field
  475.      between first and last inclusive.    If first is equal to 0
  476.      and last is equal to 0, no core requests are specified by
  477.      this RECORDRANGE.    If first is greater than last, a Value
  478.      error results.
  479.  
  480. core-replies
  481.      Specifies replies resulting from core X protocol requests
  482.      with an opcode field between first and last inclusive.  If
  483.      first is equal to 0 and last is equal to 0, no core replies
  484.      are specified by this RECORDRANGE.  If first is greater than
  485.      last, a Value error results.
  486.  
  487. ext-requests
  488.      Specifies extension protocol requests with a major opcode
  489.      field between major.first and major.last and a minor opcode
  490.      field between minor.first and minor.last inclusive.  If
  491.      major.first and major.last are equal to 0, no extension pro-
  492.      tocol requests are specified by this RECORDRANGE.    If
  493.      major.first or major.last is less than 128 and greater than
  494.      0, if major.first is greater than major.last, or if
  495.      minor.first is greater than minor.last, a Value error
  496.      results.
  497.  
  498. ext-replies
  499.      Specifies replies resulting from extension protocol requests
  500.      with a major opcode field between major.first and major.last
  501.      and a minor opcode field between minor.first and minor.last
  502.      inclusive.  If major.first and major.last are equal to 0, no
  503.      extension protocol replies are specified by this RECORD-
  504.      RANGE.  If major.first or major.last is less than 128 and
  505.      greater than 0, if major.first is greater than major.last,
  506.      or if minor.first is greater than minor.last, a Value error
  507.      results.
  508.  
  509. delivered-events
  510.      This is used for both core X protocol events and arbitrary
  511.      extension events.    Specifies events that are delivered to at
  512.      least one client that have a code field between first and
  513.      last inclusive.  If first is equal to 0 and last is equal to
  514.      0, no events are specified by this RECORDRANGE.  Otherwise,
  515.      if first is less than 2 or last is less than 2, or if first
  516.      is greater than last, a Value error results.
  517.  
  518. device-events
  519.      This is used for both core X device events and X extension
  520.      device events that may or may not be delivered to a client.
  521.      Specifies device events that have a code field between first
  522.      and last inclusive.  If first is equal to 0 and last is
  523.  
  524.  
  525.  
  526.                 6
  527.  
  528.  
  529.  
  530.  
  531.  
  532. X11, Release 6.4      Record Extension Protocol, Version 1.13
  533.  
  534.  
  535.      equal to 0, no device events are specified by this RECORD-
  536.      RANGE.  Otherwise, if first is less than 2 or last is less
  537.      than 2, or if first is greater than last, a Value error
  538.      results.
  539.  
  540.      Because the generated device event may or may not be associ-
  541.      ated with a client, unlike other RECORDRANGE components,
  542.      which select protocol for a specific client, selecting for
  543.      device events in any RECORDRANGE in an RC causes the record-
  544.      ing client to receive one instance for each device event
  545.      generated that is in the range specified.
  546.  
  547. errors
  548.      This is used for both core X protocol errors and arbitrary
  549.      extension errors.    Specifies errors that have a code field
  550.      between first and last inclusive.    If first is equal to 0
  551.      and last is equal to 0, no errors are specified by this
  552.      RECORDRANGE.  If first is greater than last, a Value error
  553.      results.
  554.  
  555. client-started
  556.      Specifies the connection setup reply.  If False, the connec-
  557.      tion setup reply is not specified by this RECORDRANGE.
  558.  
  559. client-died
  560.      Specifies notification when a client disconnects.    If False,
  561.      notification when a client disconnects is not specified by
  562.      this RECORDRANGE.
  563.  
  564.  
  565. ELEMENT_HEADER:   [from-server-time:      BOOL
  566.           from-client-time:      BOOL
  567.           from-client-sequence:   BOOL]
  568.  
  569.  
  570. The ELEMENT_HEADER structure specifies additional data that pre-
  571. cedes each protocol element in the data field of a RecordEnable-
  572. Context reply.
  573.  
  574. o  If from-server-time is True, each intercepted protocol element
  575.    with category FromServer is preceded by the server time when
  576.    the protocol was recorded.
  577.  
  578. o  If from-client-time is True, each intercepted protocol element
  579.    with category FromClient is preceded by the server time when
  580.    the protocol was recorded.
  581.  
  582. o  If from-client-sequence is True, each intercepted protocol
  583.    element with category FromClient or ClientDied is preceded by
  584.    the 32-bit sequence number of the recorded client's most
  585.    recent request processed by the server at that time.  For
  586.    FromClient, this will be one less than the sequence number of
  587.    the following request.  For ClientDied, the sequence number
  588.    will be the only data, because no protocol is recorded.
  589.  
  590.  
  591.  
  592.                 7
  593.  
  594.  
  595.  
  596.  
  597.  
  598. Record Extension Protocol, Version 1.13      X11, Release 6.4
  599.  
  600.  
  601. Note that a reply containing device events is treated the same as
  602. other replies with category FromServer for purposes of these
  603. flags.    Protocol with category FromServer is never preceded by a
  604. sequence number because almost all such protocol has a sequence
  605. number in it anyway.
  606.  
  607. If both a server time and a sequence number have been requested
  608. for a reply, each protocol request is preceded first by the time
  609. and second by the sequence number.
  610.  
  611.  
  612. XIDBASE:   CARD32
  613.  
  614.  
  615. The XIDBASE type is used to identify a particular client.  Valid
  616. values are any existing resource identifier of any connected
  617. client, in which case the client that created the resource is
  618. specified, or the resource identifier base sent to the target
  619. client from the server in the connection setup reply.  A value of
  620. 0 (zero) is valid when the XIDBASE is associated with device
  621. events that may not have been delivered to a client.
  622.  
  623.  
  624. CLIENTSPEC:   XIDBASE or {CurrentClients, FutureClients, AllClients}
  625.  
  626.  
  627. The CLIENTSPEC type defines the set of clients the RC attributes
  628. are associated with.  This type is used by recording clients when
  629. creating an RC or when changing RC attributes.    XIDBASE specifies
  630. that the RC attributes apply to a single client only.  Current-
  631. Clients specifies that the RC attributes apply to current client
  632. connections; FutureClients specifies future client connections;
  633. AllClients specifies all client connections, which includes cur-
  634. rent and future.
  635.  
  636. The numeric values for CurrentClients, FutureClients and All-
  637. Clients are defined such that there will be no intersection with
  638. valid XIDBASEs.
  639.  
  640. When the context is enabled, the data connection is unregistered
  641. if it was registered.  If the context is enabled, CurrentClients
  642. and AllClients silently exclude the recording data connection.
  643. It is an error to explicitly register the data connection.
  644.  
  645.  
  646. CLIENT_INFO:   [client-resource:       CLIENTSPEC
  647.            intercepted-protocol:   LISTofRECORDRANGE]
  648.  
  649.  
  650. This structure specifies an intercepted client and the protocol
  651. to be intercepted for the client.  The client-resource field is a
  652. resource base that identifies the intercepted client.  The inter-
  653. cepted-protocol field specifies the protocol to intercept for the
  654. client-resource.
  655.  
  656.  
  657.  
  658.                 8
  659.  
  660.  
  661.  
  662.  
  663.  
  664. X11, Release 6.4      Record Extension Protocol, Version 1.13
  665.  
  666.  
  667. 2.3.  Errors
  668.  
  669.  
  670. RecordContext
  671.      This error is returned if the value for an RC argument in a
  672.      request does not name a defined record context.
  673.  
  674.  
  675. 3.  Protocol Requests
  676.  
  677.  
  678. RecordQueryVersion
  679.  
  680.      major-version, minor-version: CARD16
  681.  
  682. ->
  683.  
  684.      major-version, minor-version: CARD16
  685.  
  686. This request specifies the RECORD extension protocol version the
  687. client would like to use.  When the specified protocol version is
  688. supported by the extension, the protocol version the server
  689. expects from the client is returned.  Clients must use this
  690. request before other RECORD extension requests.
  691.  
  692. This request also determines whether or not the RECORD extension
  693. protocol version specified by the client is supported by the
  694. extension.  If the extension supports the version specified by
  695. the client, this version number should be returned.  If the
  696. client has requested a higher version than is supported by the
  697. server, the server's highest version should be returned.  Other-
  698. wise, if the client has requested a lower version than is sup-
  699. ported by the server, the server's lowest version should be
  700. returned.  This document defines major version one (1), minor
  701. version thirteen (13).
  702.  
  703. RecordCreateContext
  704.  
  705.      context: RC
  706.  
  707.      element-header: ELEMENT_HEADER
  708.  
  709.      client-specifiers: LISTofCLIENTSPEC
  710.  
  711.      ranges: LISTofRECORDRANGE
  712.  
  713.      Errors: Match, Value, IDChoice, Alloc
  714.  
  715. This request creates a new record context within the server and
  716. assigns the identifier context to it.  After the context is cre-
  717. ated, this request registers the set of clients in client-speci-
  718. fiers with the context and specifies the protocol to intercept
  719. for those clients.  The recorded protocol elements will be pre-
  720. ceded by data as specified by element-header.  Typically, this
  721.  
  722.  
  723.  
  724.                 9
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Record Extension Protocol, Version 1.13      X11, Release 6.4
  731.  
  732.  
  733. request is used by a recording client over the control connec-
  734. tion.  Multiple RC objects can exist simultaneously, containing
  735. overlapping sets of protocol and clients to intercept.
  736.  
  737. If any of the values in element-header or ranges is invalid, a
  738. Value error results.  Duplicate items in the list of client-spec-
  739. ifiers are ignored.  If any item in the client-specifiers list is
  740. not a valid CLIENTSPEC, a Match error results.    Otherwise, each
  741. item in the client-specifiers list is processed as follows:
  742.  
  743. o  If the item is an XIDBASE identifying a particular client, the
  744.    specified client is registered with the context and the proto-
  745.    col to intercept for the client is then set to ranges.
  746.  
  747. o  If the item is CurrentClients, all existing clients are regis-
  748.    tered with the context at this time.  The protocol to inter-
  749.    cept for all clients registered with the context is then set
  750.    to ranges.
  751.  
  752. o  If the item is FutureClients, all clients that connect to the
  753.    server after this request executes will be automatically reg-
  754.    istered with the context.  The protocol to intercept for such
  755.    clients will be set to ranges in the context.
  756.  
  757. o  If the item is AllClients, the effect is as if the actions
  758.    described for FutureClients are performed, followed by the
  759.    actions for CurrentClients.
  760.  
  761. The Alloc error results when the server is unable to allocate the
  762. necessary resources.
  763.  
  764.  
  765. RecordRegisterClients
  766.  
  767.      context: RC
  768.  
  769.      element-header: ELEMENT_HEADER
  770.  
  771.      client-specifiers: LISTofCLIENTSPEC
  772.  
  773.      ranges: LISTofRECORDRANGE
  774.  
  775.      Errors: Match, Value, RecordContext, Alloc
  776.  
  777. This request registers the set of clients in client-specifiers
  778. with the given context and specifies the protocol to intercept
  779. for those clients.  The header preceding each recorded protocol
  780. element is set as specified by element-header.    These flags
  781. affect the entire context; their effect is not limited to the
  782. clients registered by this request.  Typically, this request is
  783. used by a recording client over the control connection.
  784.  
  785. If context does not name a valid RC, a RecordContext error
  786. results.  If any of the values in element-header or ranges is
  787.  
  788.  
  789.  
  790.                 10
  791.  
  792.  
  793.  
  794.  
  795.  
  796. X11, Release 6.4      Record Extension Protocol, Version 1.13
  797.  
  798.  
  799. invalid, a Value error results.  Duplicate items in the list of
  800. client-specifiers are ignored.    If any item in the list of
  801. client-specifiers is not a valid CLIENTSPEC, a Match error
  802. results.  If the context is enabled and the XID of the enabling
  803. connection is specified, a Match error results.  Otherwise, each
  804. item in the client-specifiers list is processed as follows:
  805.  
  806. o  If the item is an XIDBASE identifying a particular client, the
  807.    specified client is registered with the context if it is not
  808.    already registered.    The protocol to intercept for the client
  809.    is then set to ranges.
  810.  
  811. o  If the item is CurrentClients, all existing clients that are
  812.    not already registered with the specified context, except the
  813.    enabling connection if the context is enabled, are registered
  814.    at this time.  The protocol to intercept for all clients reg-
  815.    istered with the context is then set to ranges.
  816.  
  817. o  If the item is FutureClients, all clients that connect to the
  818.    server after this request executes will be automatically reg-
  819.    istered with the context.  The protocol to intercept for such
  820.    clients will be set to ranges in the context.  The set of
  821.    clients that are registered with the context and their corre-
  822.    sponding sets of protocol to intercept are left intact.
  823.  
  824. o  If the item is AllClients, the effect is as if the actions
  825.    described for FutureClients are performed, followed by the
  826.    actions for CurrentClients.
  827.  
  828. The Alloc error results when the server is unable to allocate the
  829. necessary resources.
  830.  
  831.  
  832. RecordUnregisterClients
  833.  
  834.      context: RC
  835.  
  836.      client-specifiers: LISTofCLIENTSPEC
  837.  
  838.      Errors: Match, RecordContext
  839.  
  840. This request removes the set of clients in client-specifiers from
  841. the given context's set of registered clients.    Typically, this
  842. request is used by a recording client over the control connec-
  843. tion.
  844.  
  845. If context does not name a valid RC, a RecordContext error
  846. results.  Duplicate items in the list of client-specifiers are
  847. ignored.  If any item in the list is not a valid CLIENTSPEC, a
  848. Match error results.  Otherwise, each item in the client-speci-
  849. fiers list is processed as follows:
  850.  
  851. o  If the item is an XIDBASE identifying a particular client, and
  852.    the specified client is currently registered with the context,
  853.  
  854.  
  855.  
  856.                 11
  857.  
  858.  
  859.  
  860.  
  861.  
  862. Record Extension Protocol, Version 1.13      X11, Release 6.4
  863.  
  864.  
  865.    it is unregistered, and the set of protocol to intercept for
  866.    the client is deleted from the context.  If the specified
  867.    client is not registered with the context, the item has no
  868.    effect.
  869.  
  870. o  If the item is CurrentClients, all clients currently regis-
  871.    tered with the context are unregistered from it, and their
  872.    corresponding sets of protocol to intercept are deleted from
  873.    the context.
  874.  
  875. o  If the item is FutureClients, clients that connect to the
  876.    server after this request executes will not automatically be
  877.    registered with the context.  The set of clients that are reg-
  878.    istered with this context and their corresponding sets of pro-
  879.    tocol that will be intercepted are left intact.
  880.  
  881. o  If the item is AllClients, the effect is as if the actions
  882.    described for FutureClients are performed, followed by the
  883.    actions for CurrentClients.
  884.  
  885. A client is unregistered automatically when it disconnects.
  886.  
  887.  
  888. RecordGetContext
  889.  
  890.      context: RC
  891.  
  892. ->
  893.  
  894.      enabled: BOOL
  895.  
  896.      element-header: ELEMENT_HEADER
  897.  
  898.      intercepted-clients: LISTofCLIENT_INFO
  899.  
  900.      Errors: RecordContext
  901.  
  902. This request queries the current state of the specified context
  903. and is typically used by a recording client over the control con-
  904. nection.  The enabled field specifies the state of data transfer
  905. between the extension and the recording client, and is either
  906. enabled (True) or disabled (False).  The initial state is dis-
  907. abled.    When enabled, all core X protocol and extension protocol
  908. received from (requests) or sent to (replies, errors, events) a
  909. particular client, and requested to be intercepted by the record-
  910. ing client, is reported to the recording client over the data
  911. connection.  The element-header specifies the header that pre-
  912. cedes each recorded protocol element.  The intercepted-clients
  913. field specifies the list of clients currently being recorded and
  914. the protocol associated with each client.  If future clients will
  915. be automatically registered with the context, one of the returned
  916. CLIENT_INFO structures has a client-resource value of Future-
  917. Clients and an intercepted-protocol giving the protocol to inter-
  918. cept for future clients.  Protocol ranges may be decomposed,
  919.  
  920.  
  921.  
  922.                 12
  923.  
  924.  
  925.  
  926.  
  927.  
  928. X11, Release 6.4      Record Extension Protocol, Version 1.13
  929.  
  930.  
  931. coalesced, or otherwise modified by the server from how they were
  932. specified by the client.  All CLIENTSPECs registered with the
  933. server are returned, even if the RECORDRANGE(s) associated with
  934. them specify no protocol to record.
  935.  
  936. When the context argument is not valid, a RecordContext error
  937. results.
  938.  
  939.  
  940. RecordEnableContext
  941.  
  942.      context: RC
  943.  
  944. ->+
  945.  
  946.      category: {FromServer, FromClient, ClientStarted, Client-
  947.      Died, StartOfData, EndOfData}
  948.  
  949.      element-header: ELEMENT_HEADER
  950.  
  951.      client-swapped: BOOL
  952.  
  953.      id-base: XIDBASE
  954.  
  955.      server-time: TIMESTAMP
  956.  
  957.      recorded-sequence-number: CARD32
  958.  
  959.      data: LISTofBYTE
  960.  
  961.      Errors: Match, RecordContext
  962.  
  963. This request enables data transfer between the recording client
  964. and the extension and returns the protocol data the recording
  965. client has previously expressed interest in.  Typically, this
  966. request is executed by the recording client over the data connec-
  967. tion.
  968.  
  969. If the client is registered on the context, it is unregistered
  970. before any recording begins.
  971.  
  972. Once the server receives this request, it begins intercepting and
  973. reporting to the recording client all core and extension protocol
  974. received from or sent to clients registered with the RC that the
  975. recording client has expressed interest in.  All intercepted pro-
  976. tocol data is returned in the byte-order of the recorded client.
  977. Therefore, recording clients are responsible for all byte swap-
  978. ping, if required.  More than one recording client cannot enable
  979. data transfer on the same RC at the same time.    Multiple inter-
  980. cepted requests, replies, events and errors might be packaged
  981. into a single reply before being returned to the recording
  982. clients.
  983.  
  984.  
  985.  
  986.  
  987.  
  988.                 13
  989.  
  990.  
  991.  
  992.  
  993.  
  994. Record Extension Protocol, Version 1.13      X11, Release 6.4
  995.  
  996.  
  997. The category field determines the possible types of the data.
  998. When a context is enabled, the server will immediately send a
  999. reply of category StartOfData to notify the client that recording
  1000. is enabled.  A category of FromClient means the data are from the
  1001. client (requests); FromServer means data are from the server
  1002. (replies, errors, events, or device events).  For a new client,
  1003. the category is ClientStarted and the data are the connection
  1004. setup reply.  When the recorded client connection is closed, cat-
  1005. egory is set to the value ClientDied and no protocol is included
  1006. in this reply.    When the disable request is made over the control
  1007. connection, a final reply is sent over the data connection with
  1008. category EndOfData and no protocol.
  1009.  
  1010. The element-header field returns the value currently set for the
  1011. context, which tells what header information precedes each
  1012. recorded protocol element in this reply.
  1013.  
  1014. The client-swapped field is True if the byte order of the proto-
  1015. col being recorded is swapped relative to the recording client;
  1016. otherwise, client-swapped is False.  The recorded protocol is in
  1017. the byte order of the client being recorded; device events are in
  1018. the byte order of the recording client.  For replies of category
  1019. StartOfData and EndOfData the client-swapped bit is set according
  1020. to the byte order of the server relative to the recording client.
  1021. The id-base field is the resource identifier base sent to the
  1022. client from the server in the connection setup reply, and hence,
  1023. identifies the client being recorded.  The id-base field is 0
  1024. (zero) when the protocol data being returned are device events.
  1025. The server-time field is set to the time of the server when the
  1026. first protocol element in this reply was intercepted.  The
  1027. server-time of reply N+1 is greater than or equal to the server-
  1028. time of reply N, and is greater than or equal to the time of the
  1029. last protocol element in reply N.
  1030.  
  1031. The recorded-sequence-number field is set to the sequence number
  1032. of the recorded client's most recent request processed by the
  1033. server.
  1034.  
  1035. The data field contains the raw protocol data being returned to
  1036. the recording client.  If requested by the element-header of this
  1037. record context, each protocol element may be preceded by a 32-bit
  1038. timestamp and/or a 32-bit sequence number.  If present, both the
  1039. timestamp and sequence number are always in the byte order of the
  1040. recording client.
  1041.  
  1042. For the core X events KeyPress, KeyRelease, ButtonPress, and
  1043. ButtonRelease, the fields of a device event that contain valid
  1044. information are time and detail.  For the core X event
  1045. MotionNotify, the fields of a device event that contain valid
  1046. information are time, root, root-x and root-y.    The time field
  1047. refers to the time the event was generated by the device.
  1048.  
  1049. For the extension input device events DeviceKeyPress,
  1050. DeviceKeyRelease, DeviceButtonPress, and DeviceButtonRelease, the
  1051.  
  1052.  
  1053.  
  1054.                 14
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. X11, Release 6.4      Record Extension Protocol, Version 1.13
  1061.  
  1062.  
  1063. fields of a device event that contain valid information are
  1064. device, time and detail.  For DeviceMotionNotify, the valid
  1065. device event fields are device and time.  For the extension input
  1066. device events ProximityIn and ProximityOut, the fields of a
  1067. device event that contain valid information are device and time.
  1068. For the extension input device event DeviceValuator, the fields
  1069. of a device event that contain valid information are device,
  1070. num_valuators, first_valuator, and valuators.  The time field
  1071. refers to the time the event was generated by the device.
  1072.  
  1073. The error Match is returned when data transfer is already
  1074. enabled.  When the context argument is not valid, a RecordContext
  1075. error results.
  1076.  
  1077.  
  1078. RecordDisableContext
  1079.  
  1080.      context: RC
  1081.  
  1082.      Errors: RecordContext
  1083.  
  1084. This request is typically executed by the recording client over
  1085. the control connection.  This request directs the extension to
  1086. immediately send any complete protocol elements currently
  1087. buffered, to send a final reply with category EndOfData, and to
  1088. discontinue data transfer between the extension and the recording
  1089. client.  Protocol reporting is disabled on the data connection
  1090. that is currently enabled for the given context.  Once the exten-
  1091. sion completes processing this request, no additional recorded
  1092. protocol will be reported to the recording client.  If a data
  1093. connection is not currently enabled when this request is exe-
  1094. cuted, then this request has no affect on the state of data
  1095. transfer.  An RC is disabled automatically when the connection to
  1096. the enabling client is closed down.
  1097.  
  1098. When the context argument is not valid, a RecordContext error
  1099. results.
  1100.  
  1101.  
  1102. RecordFreeContext
  1103.  
  1104.      context : RC
  1105.  
  1106.      Errors: RecordContext
  1107.  
  1108. This request deletes the association between the resource ID and
  1109. the RC and destroys the RC.  If a client has enabled data trans-
  1110. fer on this context, the actions described in RecordDisable-
  1111. Context are performed before the context is freed.
  1112.  
  1113. An RC is destroyed automatically when the connection to the cre-
  1114. ating client is closed down and the close-down mode is Destroy-
  1115. All.  When the context argument is not valid, a RecordContext
  1116. error results.
  1117.  
  1118.  
  1119.  
  1120.                 15
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. Record Extension Protocol, Version 1.13      X11, Release 6.4
  1127.  
  1128.  
  1129. 4.  Encoding
  1130.  
  1131. Please refer to the X11 Protocol Encoding document as this docu-
  1132. ment uses conventions established there.
  1133.  
  1134. The name of this extension is "RECORD".
  1135.  
  1136.  
  1137. 4.1.  Types
  1138.  
  1139. RC: CARD32
  1140.  
  1141.  
  1142. RANGE8
  1143.   1      CARD8           first
  1144.   1      CARD8           last
  1145.  
  1146.  
  1147.  
  1148. RANGE16
  1149.   2      CARD16          first
  1150.   2      CARD16          last
  1151.  
  1152.  
  1153.  
  1154. EXTRANGE
  1155.   2      RANGE8          major
  1156.   4      RANGE16          minor
  1157.  
  1158.  
  1159.  
  1160. RECORDRANGE
  1161.   2      RANGE8          core-requests
  1162.   2      RANGE8          core-replies
  1163.   6      EXTRANGE          ext-requests
  1164.   6      EXTRANGE          ext-replies
  1165.   2      RANGE8          delivered-events
  1166.   2      RANGE8          device-events
  1167.   2      RANGE8          errors
  1168.   1      BOOL              client-started
  1169.   1      BOOL              client-died
  1170.  
  1171.  
  1172.  
  1173. ELEMENT_HEADER
  1174.   1      CARD8
  1175.       0x01        from-server-time
  1176.       0x02        from-client-time
  1177.       0x04        from-client-sequence
  1178.  
  1179.  
  1180. XIDBASE: CARD32
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.                 16
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. X11, Release 6.4      Record Extension Protocol, Version 1.13
  1193.  
  1194.  
  1195. CLIENTSPEC
  1196.   4      XIDBASE          client-id-base
  1197.       1        CurrentClients
  1198.       2        FutureClients
  1199.       3        AllClients
  1200.  
  1201.  
  1202.  
  1203. CLIENT_INFO
  1204.   4      CLIENTSPEC          client-resource
  1205.   4      CARD32          n, number of record ranges in intercepted-protocol
  1206.   24n      LISTofRECORDRANGE   intercepted-protocol
  1207.  
  1208.  
  1209. 4.2.  Errors
  1210.  
  1211.  
  1212. RecordContext
  1213.   1      0              Error
  1214.   1      CARD8           extension's base error code + 0
  1215.   2      CARD16          sequence number
  1216.   4      CARD32          invalid record context
  1217.   24                  unused
  1218.  
  1219.  
  1220. 4.3.  Requests
  1221.  
  1222.  
  1223. RecordQueryVersion
  1224.   1      CARD8           major opcode
  1225.   1      0              minor opcode
  1226.   2      2              request length
  1227.   2      CARD16          major version
  1228.   2      CARD16          minor version
  1229.  =>
  1230.   1      1              Reply
  1231.   1                  unused
  1232.   2      CARD16          sequence number
  1233.   4      0              reply length
  1234.   2      CARD16          major version
  1235.   2      CARD16          minor version
  1236.   20                  unused
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.                 17
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. Record Extension Protocol, Version 1.13      X11, Release 6.4
  1259.  
  1260.  
  1261. RecordCreateContext
  1262.   1      CARD8           major opcode
  1263.   1      1              minor opcode
  1264.   2      5+m+6n          request length
  1265.   4      RC              context
  1266.   1      ELEMENT_HEADER      element-header
  1267.   3                  unused
  1268.   4      CARD32          m, number of client-specifiers
  1269.   4      CARD32          n, number of ranges
  1270.   4m      LISTofCLIENTSPEC    client-specifiers
  1271.   24n      LISTofRECORDRANGE   ranges
  1272.  
  1273.  
  1274.  
  1275. RecordRegisterClients
  1276.   1      CARD8           major opcode
  1277.   1      2              minor opcode
  1278.   2      5+m+6n          request length
  1279.   4      RC              context
  1280.   1      ELEMENT_HEADER      element-header
  1281.   3                  unused
  1282.   4      CARD32          m, number of client-specifiers
  1283.   4      CARD32          n, number of ranges
  1284.   4m      LISTofCLIENTSPEC    client-specifiers
  1285.   24n      LISTofRECORDRANGE   ranges
  1286.  
  1287.  
  1288.  
  1289. RecordUnregisterClients
  1290.   1      CARD8           major opcode
  1291.   1      3              minor opcode
  1292.   2      3+m              request length
  1293.   4      RC              context
  1294.   4      CARD32          m, number of client-specifiers
  1295.   4m      LISTofCLIENTSPEC    client-specifiers
  1296.  
  1297.  
  1298.  
  1299. RecordGetContext
  1300.   1      CARD8           major opcode
  1301.   1      4              minor opcode
  1302.   2      2              request length
  1303.   4      RC              context
  1304.  =>
  1305.   1      1              Reply
  1306.   1      BOOL              enabled
  1307.   2      CARD16          sequence number
  1308.   4      j              reply length
  1309.   1      ELEMENT_HEADER      element-header
  1310.   3                  unused
  1311.   4      CARD32          n, number of intercepted-clients
  1312.   16                  unused
  1313.   4j      LISTofCLIENT_INFO   intercepted-clients
  1314.  
  1315.  
  1316.  
  1317.  
  1318.                 18
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324. X11, Release 6.4      Record Extension Protocol, Version 1.13
  1325.  
  1326.  
  1327. RecordEnableContext
  1328.   1      CARD8           major opcode
  1329.   1      5              minor opcode
  1330.   2      2              request length
  1331.   4      RC              context
  1332.  =>+
  1333.   1      1              Reply
  1334.   1                  category
  1335.       0        FromServer
  1336.       1        FromClient
  1337.       2        ClientStarted
  1338.       3        ClientDied
  1339.       4        StartOfData
  1340.       5        EndOfData
  1341.   2      CARD16          sequence number
  1342.   4      n              reply length
  1343.   1      ELEMENT_HEADER      element-header
  1344.   1      BOOL              client-swapped
  1345.   2                  unused
  1346.   4      XIDBASE          id-base
  1347.   4      TIMESTAMP          server-time
  1348.   4      CARD32          recorded-sequence-number
  1349.   8                  unused
  1350.   4n      BYTE              data
  1351.  
  1352.  
  1353.  
  1354. RecordDisableContext
  1355.   1      CARD8           major opcode
  1356.   1      6              minor opcode
  1357.   2      2              request length
  1358.   4      RC              context
  1359.  
  1360.  
  1361.  
  1362. RecordFreeContext
  1363.   1      CARD8           major opcode
  1364.   1      7              minor opcode
  1365.   2      2              request length
  1366.   4      RC              context
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.                 19
  1385.  
  1386.  
  1387.