1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun Copyright 1992, 1998 The Open Group
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun Permission to use, copy, modify, distribute, and sell this software and its
6*4882a593Smuzhiyun documentation for any purpose is hereby granted without fee, provided that
7*4882a593Smuzhiyun the above copyright notice appear in all copies and that both that
8*4882a593Smuzhiyun copyright notice and this permission notice appear in supporting
9*4882a593Smuzhiyun documentation.
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun The above copyright notice and this permission notice shall be included
12*4882a593Smuzhiyun in all copies or substantial portions of the Software.
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15*4882a593Smuzhiyun OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16*4882a593Smuzhiyun MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17*4882a593Smuzhiyun IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*4882a593Smuzhiyun OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*4882a593Smuzhiyun ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*4882a593Smuzhiyun OTHER DEALINGS IN THE SOFTWARE.
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun Except as contained in this notice, the name of The Open Group shall
23*4882a593Smuzhiyun not be used in advertising or otherwise to promote the sale, use or
24*4882a593Smuzhiyun other dealings in this Software without prior written authorization
25*4882a593Smuzhiyun from The Open Group.
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun */
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun #ifdef HAVE_DIX_CONFIG_H
30*4882a593Smuzhiyun #include <dix-config.h>
31*4882a593Smuzhiyun #endif
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun #include <X11/X.h>
34*4882a593Smuzhiyun #include <X11/Xproto.h>
35*4882a593Smuzhiyun #include "misc.h"
36*4882a593Smuzhiyun #include "os.h"
37*4882a593Smuzhiyun #include "dixstruct.h"
38*4882a593Smuzhiyun #include "extnsionst.h"
39*4882a593Smuzhiyun #include <X11/extensions/bigreqsproto.h>
40*4882a593Smuzhiyun #include "opaque.h"
41*4882a593Smuzhiyun #include "extinit.h"
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun static int
ProcBigReqDispatch(ClientPtr client)44*4882a593Smuzhiyun ProcBigReqDispatch(ClientPtr client)
45*4882a593Smuzhiyun {
46*4882a593Smuzhiyun REQUEST(xBigReqEnableReq);
47*4882a593Smuzhiyun xBigReqEnableReply rep;
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun if (client->swapped) {
50*4882a593Smuzhiyun swaps(&stuff->length);
51*4882a593Smuzhiyun }
52*4882a593Smuzhiyun if (stuff->brReqType != X_BigReqEnable)
53*4882a593Smuzhiyun return BadRequest;
54*4882a593Smuzhiyun REQUEST_SIZE_MATCH(xBigReqEnableReq);
55*4882a593Smuzhiyun client->big_requests = TRUE;
56*4882a593Smuzhiyun rep = (xBigReqEnableReply) {
57*4882a593Smuzhiyun .type = X_Reply,
58*4882a593Smuzhiyun .sequenceNumber = client->sequence,
59*4882a593Smuzhiyun .length = 0,
60*4882a593Smuzhiyun .max_request_size = maxBigRequestSize
61*4882a593Smuzhiyun };
62*4882a593Smuzhiyun if (client->swapped) {
63*4882a593Smuzhiyun swaps(&rep.sequenceNumber);
64*4882a593Smuzhiyun swapl(&rep.max_request_size);
65*4882a593Smuzhiyun }
66*4882a593Smuzhiyun WriteToClient(client, sizeof(xBigReqEnableReply), &rep);
67*4882a593Smuzhiyun return Success;
68*4882a593Smuzhiyun }
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun void
BigReqExtensionInit(void)71*4882a593Smuzhiyun BigReqExtensionInit(void)
72*4882a593Smuzhiyun {
73*4882a593Smuzhiyun AddExtension(XBigReqExtensionName, 0, 0,
74*4882a593Smuzhiyun ProcBigReqDispatch, ProcBigReqDispatch,
75*4882a593Smuzhiyun NULL, StandardMinorOpcode);
76*4882a593Smuzhiyun }
77