1706f2543Smrg/*
2706f2543Smrg
3706f2543SmrgCopyright 1992, 1998  The Open Group
4706f2543Smrg
5706f2543SmrgPermission to use, copy, modify, distribute, and sell this software and its
6706f2543Smrgdocumentation for any purpose is hereby granted without fee, provided that
7706f2543Smrgthe above copyright notice appear in all copies and that both that
8706f2543Smrgcopyright notice and this permission notice appear in supporting
9706f2543Smrgdocumentation.
10706f2543Smrg
11706f2543SmrgThe above copyright notice and this permission notice shall be included
12706f2543Smrgin all copies or substantial portions of the Software.
13706f2543Smrg
14706f2543SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15706f2543SmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16706f2543SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17706f2543SmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18706f2543SmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19706f2543SmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20706f2543SmrgOTHER DEALINGS IN THE SOFTWARE.
21706f2543Smrg
22706f2543SmrgExcept as contained in this notice, the name of The Open Group shall
23706f2543Smrgnot be used in advertising or otherwise to promote the sale, use or
24706f2543Smrgother dealings in this Software without prior written authorization
25706f2543Smrgfrom The Open Group.
26706f2543Smrg
27706f2543Smrg*/
28706f2543Smrg
29706f2543Smrg#ifdef HAVE_DIX_CONFIG_H
30706f2543Smrg#include <dix-config.h>
31706f2543Smrg#endif
32706f2543Smrg
33706f2543Smrg#include <X11/X.h>
34706f2543Smrg#include <X11/Xproto.h>
35706f2543Smrg#include "misc.h"
36706f2543Smrg#include "os.h"
37706f2543Smrg#include "dixstruct.h"
38706f2543Smrg#include "extnsionst.h"
39706f2543Smrg#include <X11/extensions/bigreqsproto.h>
40706f2543Smrg#include "opaque.h"
41706f2543Smrg#include "modinit.h"
42706f2543Smrg
43706f2543Smrgvoid BigReqExtensionInit(INITARGS);
44706f2543Smrg
45706f2543Smrgstatic int
46706f2543SmrgProcBigReqDispatch (ClientPtr client)
47706f2543Smrg{
48706f2543Smrg    REQUEST(xBigReqEnableReq);
49706f2543Smrg    xBigReqEnableReply rep;
50706f2543Smrg     int n;
51706f2543Smrg
52706f2543Smrg    if (client->swapped) {
53706f2543Smrg	swaps(&stuff->length, n);
54706f2543Smrg    }
55706f2543Smrg    if (stuff->brReqType != X_BigReqEnable)
56706f2543Smrg	return BadRequest;
57706f2543Smrg    REQUEST_SIZE_MATCH(xBigReqEnableReq);
58706f2543Smrg    client->big_requests = TRUE;
59706f2543Smrg    memset(&rep, 0, sizeof(xBigReqEnableReply));
60706f2543Smrg    rep.type = X_Reply;
61706f2543Smrg    rep.length = 0;
62706f2543Smrg    rep.sequenceNumber = client->sequence;
63706f2543Smrg    rep.max_request_size = maxBigRequestSize;
64706f2543Smrg    if (client->swapped) {
65706f2543Smrg    	swaps(&rep.sequenceNumber, n);
66706f2543Smrg	swapl(&rep.max_request_size, n);
67706f2543Smrg    }
68706f2543Smrg    WriteToClient(client, sizeof(xBigReqEnableReply), (char *)&rep);
69706f2543Smrg    return Success;
70706f2543Smrg}
71706f2543Smrg
72706f2543Smrgvoid
73706f2543SmrgBigReqExtensionInit(INITARGS)
74706f2543Smrg{
75706f2543Smrg    AddExtension(XBigReqExtensionName, 0, 0,
76706f2543Smrg		 ProcBigReqDispatch, ProcBigReqDispatch,
77706f2543Smrg		 NULL, StandardMinorOpcode);
78706f2543Smrg}
79