2 * (C) Copyright IBM Corporation 2005, 2006
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sub license,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * \file indirect_table.h
29 * \author Ian Romanick <idr@us.ibm.com>
32 #ifndef INDIRECT_TABLE_H
33 #define INDIRECT_TABLE_H
39 struct __glXDispatchInfo
{
41 * Number of significant bits in the protocol opcode. Opcodes with values
42 * larger than ((1 << bits) - 1) are invalid.
48 const int_fast16_t * dispatch_tree
;
51 * Array of protocol decode and dispatch functions index by the opcode
52 * search tree (i.e., \c dispatch_tree). The first element in each pair
53 * is the non-byte-swapped version, and the second element is the
54 * byte-swapped version.
56 const void *(*dispatch_functions
)[2];
59 * Pointer to size validation data. This table is indexed with the same
60 * value as ::dispatch_functions.
62 * The first element in the pair is the size, in bytes, of the fixed-size
63 * portion of the protocol.
65 * For opcodes that have a variable-size portion, the second value is an
66 * index in \c size_func_table to calculate that size. If there is no
67 * variable-size portion, this index will be ~0.
70 * If size checking is not to be performed on this type of protocol
71 * data, this pointer will be \c NULL.
73 const int_fast16_t (*size_table
)[2];
76 * Array of functions used to calculate the variable-size portion of
77 * protocol messages. Indexed by the second element of the entries
81 * If size checking is not to be performed on this type of protocol
82 * data, this pointer will be \c NULL.
84 const gl_proto_size_func
*size_func_table
;
88 * Sentinel value for an empty leaf in the \c dispatch_tree.
90 #define EMPTY_LEAF INT_FAST16_MIN
93 * Declare the index \c x as a leaf index.
98 * Determine if an index is a leaf index.
100 #define IS_LEAF_INDEX(x) ((x) <= 0)
102 extern const struct __glXDispatchInfo Single_dispatch_info
;
103 extern const struct __glXDispatchInfo Render_dispatch_info
;
104 extern const struct __glXDispatchInfo VendorPriv_dispatch_info
;
106 #endif /* INDIRECT_TABLE_H */