~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/include/extensions/Printstr.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Xorg: Printstr.h,v 1.3 2000/08/18 04:05:44 coskrey Exp $ */
 
2
/******************************************************************************
 
3
 ******************************************************************************
 
4
 **
 
5
 ** File:         Printstr.h
 
6
 **
 
7
 ** Description: Definitions needed by the server and library, but
 
8
 **              not clients.
 
9
 **
 
10
 **              Print.h for server, library and clients.
 
11
 **
 
12
 ******************************************************************************
 
13
 **
 
14
 ** (c) Copyright 1996 Hewlett-Packard Company
 
15
 ** (c) Copyright 1996 International Business Machines Corp.
 
16
 ** (c) Copyright 1996 Sun Microsystems, Inc.
 
17
 ** (c) Copyright 1996 Novell, Inc.
 
18
 ** (c) Copyright 1996 Digital Equipment Corp.
 
19
 ** (c) Copyright 1996 Fujitsu Limited
 
20
 ** (c) Copyright 1996 Hitachi, Ltd.
 
21
 ** 
 
22
 ** Permission is hereby granted, free of charge, to any person obtaining a copy
 
23
 ** of this software and associated documentation files (the "Software"), to deal
 
24
 ** in the Software without restriction, including without limitation the rights
 
25
 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
26
 ** copies of the Software, and to permit persons to whom the Software is
 
27
 ** furnished to do so, subject to the following conditions:
 
28
 **
 
29
 ** The above copyright notice and this permission notice shall be included in
 
30
 ** all copies or substantial portions of the Software.
 
31
 **
 
32
 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
33
 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
34
 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
35
 ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 
36
 ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
37
 ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
38
 **
 
39
 ** Except as contained in this notice, the names of the copyright holders shall
 
40
 ** not be used in advertising or otherwise to promote the sale, use or other
 
41
 ** dealings in this Software without prior written authorization from said
 
42
 ** copyright holders.
 
43
 **
 
44
 ******************************************************************************
 
45
 *****************************************************************************/
 
46
/* $XFree86: xc/include/extensions/Printstr.h,v 1.6 2001/08/23 12:46:11 alanh Exp $ */
 
47
 
 
48
 
 
49
#ifndef _XpPrintstr_H_
 
50
#define _XpPrintstr_H_
 
51
 
 
52
/*
 
53
 * NEED_EVENTS and NEED_REPLIES are hacks to limit the linker symbol-table
 
54
 * size.   When function prototypes are needed from Print.h, this sets up
 
55
 * a cascading dependency on Printstr.h and eventually Xproto.h to provide
 
56
 * the event and reply struct definitions.
 
57
 */
 
58
#ifndef NEED_EVENTS
 
59
#define NEED_EVENTS
 
60
#endif /* NEED_EVENTS */
 
61
 
 
62
#define NEED_REPLIES
 
63
 
 
64
#include <X11/Xproto.h>
 
65
#ifndef _XP_PRINT_SERVER_
 
66
#include <X11/Xlib.h>
 
67
#endif /* _XP_PRINT_SERVER_ */
 
68
 
 
69
/*
 
70
 * Pull in other definitions.  Print.h will hide some things if we're
 
71
 * doing server side work.
 
72
 */
 
73
#include <X11/extensions/Print.h>
 
74
 
 
75
#include <X11/Xfuncproto.h>
 
76
 
 
77
_XFUNCPROTOBEGIN
 
78
 
 
79
/******************************************************************************
 
80
 *
 
81
 * Protocol requests constants and alignment values
 
82
 *
 
83
 * Note: Xlib macro's expect X_ABC where ABC is the name of the
 
84
 * protocol request.
 
85
 */
 
86
#define X_PrintQueryVersion             0
 
87
#define X_PrintGetPrinterList           1
 
88
#define X_PrintCreateContext            2
 
89
#define X_PrintSetContext               3
 
90
#define X_PrintGetContext               4
 
91
#define X_PrintDestroyContext           5
 
92
#define X_PrintGetContextScreen         6
 
93
#define X_PrintStartJob                 7
 
94
#define X_PrintEndJob                   8
 
95
#define X_PrintStartDoc                 9
 
96
#define X_PrintEndDoc                   10
 
97
#define X_PrintPutDocumentData          11
 
98
#define X_PrintGetDocumentData          12
 
99
#define X_PrintStartPage                13
 
100
#define X_PrintEndPage                  14
 
101
#define X_PrintSelectInput              15
 
102
#define X_PrintInputSelected            16
 
103
#define X_PrintGetAttributes            17
 
104
#define X_PrintSetAttributes            18
 
105
#define X_PrintGetOneAttribute          19
 
106
#define X_PrintRehashPrinterList        20
 
107
#define X_PrintGetPageDimensions        21
 
108
#define X_PrintQueryScreens             22
 
109
#define X_PrintSetImageResolution       23
 
110
#define X_PrintGetImageResolution       24
 
111
 
 
112
/********************************************************************
 
113
 *
 
114
 * Protocol data types
 
115
 */
 
116
#define PCONTEXT CARD32
 
117
#define WINDOW   CARD32
 
118
#define DRAWABLE CARD32
 
119
#define BITMASK  CARD32
 
120
 
 
121
/******************************************************************************
 
122
 *
 
123
 * Event wire struct definitions
 
124
 *
 
125
 * Note: Xlib macro's expect xABC struct names and sz_xABC size
 
126
 * constants where ABC is the name of the protocol request.
 
127
 */
 
128
 
 
129
 
 
130
/*********************************************************************
 
131
 *
 
132
 * Events.
 
133
 *
 
134
 * See Print.h for the protocol "type" values.
 
135
 */
 
136
typedef struct _xPrintPrintEvent {
 
137
        BYTE type;              /* XPPrintNotify + extEntry->eventBase */
 
138
        BYTE detail;            /* XPStartJobNotify, XPEndJobNotify,
 
139
                                   XPStartDocNotify, XPEndDocNotify,
 
140
                                   XPStartPageNotify, XPEndPageNotify */
 
141
        CARD16 sequenceNumber B16;
 
142
        PCONTEXT printContext B32; /* print context */
 
143
        BOOL   cancel;          /* canceled flag */
 
144
        CARD8  pad1;            /* rest is unused */
 
145
        CARD16 pad2 B16;
 
146
        CARD32 pad3 B32;
 
147
        CARD32 pad4 B32;
 
148
        CARD32 pad5 B32;
 
149
        CARD32 pad6 B32;
 
150
        CARD32 pad7 B32;
 
151
} xPrintPrintEvent;
 
152
#define sz_xPrintPrintEvent 32;
 
153
 
 
154
typedef struct _xPrintAttributeEvent {
 
155
        BYTE   type;            /* XPAttributeNotify + extEntry->eventBase */
 
156
        BYTE   detail;          /* XPJobAttr, XPDocAttr, XPPageAttr,
 
157
                                   XPPrinterAttr, XPSpoolerAttr,
 
158
                                   XPMediumAttr, XPServerAttr */
 
159
        CARD16 sequenceNumber B16;
 
160
        PCONTEXT printContext B32; /* print context */
 
161
        CARD32 pad1 B32;
 
162
        CARD32 pad2 B32;
 
163
        CARD32 pad3 B32;
 
164
        CARD32 pad4 B32;
 
165
        CARD32 pad5 B32;
 
166
        CARD32 pad6 B32;
 
167
} xPrintAttributeEvent;
 
168
#define sz_xPrintAttributeEvent 32;
 
169
 
 
170
 
 
171
/*********************************************************************
 
172
 *
 
173
 * Requests
 
174
 */
 
175
typedef struct _PrintQueryVersion {
 
176
        CARD8   reqType;                /* always PrintReqCode */
 
177
        CARD8   printReqType;           /* always X_PrintQueryVersion */
 
178
        CARD16  length B16;
 
179
} xPrintQueryVersionReq;
 
180
#define sz_xPrintQueryVersionReq        4
 
181
 
 
182
typedef struct {
 
183
        BYTE    type;                   /* X_Reply */
 
184
        CARD8   unused;                 /* not used */
 
185
        CARD16  sequenceNumber B16;
 
186
        CARD32  length B32;
 
187
        CARD16  majorVersion B16;       /* major version of Xp protocol */
 
188
        CARD16  minorVersion B16;       /* minor version of Xp protocol */
 
189
        CARD32  pad1 B32;
 
190
        CARD32  pad2 B32;
 
191
        CARD32  pad3 B32;
 
192
        CARD32  pad4 B32;
 
193
        CARD32  pad5 B32;
 
194
} xPrintQueryVersionReply;
 
195
#define sz_xPrintQueryVersionReply      32
 
196
 
 
197
 
 
198
typedef struct _PrintGetPrinterList {
 
199
        CARD8   reqType;                /* always PrintReqCode */
 
200
        CARD8   printReqType;           /* always X_PrintGetPrinterList */
 
201
        CARD16  length B16;
 
202
        CARD32  printerNameLen B32;     /* length of printer name */
 
203
        CARD32  localeLen B32;          /* length of locale string */
 
204
 
 
205
        /* variable portion *****************************************
 
206
        STRING8 printerName;             * printer name *
 
207
        BYTE    pad(printerNameLen)      * unused *
 
208
        STRING8 locale;                  * locale *
 
209
        BYTE    pad(localeLen)           * unused *
 
210
        ************************************************************/
 
211
} xPrintGetPrinterListReq;
 
212
#define sz_xPrintGetPrinterListReq      12
 
213
 
 
214
typedef struct {
 
215
        BYTE    type;                   /* X_Reply */
 
216
        CARD8   unused;                 /* not used */
 
217
        CARD16  sequenceNumber B16;
 
218
        CARD32  length B32;
 
219
        CARD32  listCount B32;          /* of PRINTER recs below */
 
220
        CARD32  pad1 B32;
 
221
        CARD32  pad2 B32;
 
222
        CARD32  pad3 B32;
 
223
        CARD32  pad4 B32;
 
224
        CARD32  pad5 B32;
 
225
 
 
226
        /* variable portion *****************************************
 
227
        CARD32  nameLen B32;            * length of name in bytes *
 
228
        STRING8 name;                   * name *
 
229
        BYTE    pad(nameLen)            * unused *
 
230
 
 
231
        CARD32  descLen B32;            * length of desc in bytes *
 
232
        STRING8 desc;                   * localized description *
 
233
        BYTE    pad(descLen)            * unused *
 
234
        ************************************************************/
 
235
} xPrintGetPrinterListReply;
 
236
#define sz_xPrintGetPrinterListReply    32
 
237
 
 
238
 
 
239
typedef struct _PrintRehashPrinterList {
 
240
        CARD8   reqType;                /* always PrintReqCode */
 
241
        CARD8   printReqType;           /* always X_PrintRehashPrinterList */
 
242
        CARD16  length B16;
 
243
} xPrintRehashPrinterListReq;
 
244
#define sz_xPrintRehashPrinterListReq   4
 
245
 
 
246
 
 
247
typedef struct _PrintCreateContext {
 
248
        CARD8   reqType;                /* always PrintReqCode */
 
249
        CARD8   printReqType;           /* always X_PrintInitSetContext */
 
250
        CARD16  length B16;
 
251
        CARD32  contextID B32;          /* ID for context */
 
252
        CARD32  printerNameLen B32;     /* length of printerName in bytes */
 
253
        CARD32  localeLen B32;          /* length of locale in bytes */
 
254
 
 
255
        /* variable portion *****************************************
 
256
        STRING8 printerName              * printer name *
 
257
        BYTE    pad(printerNameLen)      * unused *
 
258
        STRING8 locale                   * locale *
 
259
        BYTE    pad(locale)              * unused *
 
260
        ************************************************************/
 
261
} xPrintCreateContextReq;               
 
262
#define sz_xPrintCreateContextReq       16
 
263
 
 
264
 
 
265
typedef struct _PrintSetContext {
 
266
        CARD8   reqType;                /* always PrintReqCode */
 
267
        CARD8   printReqType;           /* always X_PrintSetContext */
 
268
        CARD16  length B16;
 
269
        PCONTEXT printContext B32;      /* print context */
 
270
} xPrintSetContextReq;          
 
271
#define sz_xPrintSetContextReq          8
 
272
 
 
273
 
 
274
typedef struct _PrintGetContext {
 
275
        CARD8   reqType;                /* always PrintReqCode */
 
276
        CARD8   printReqType;           /* always X_PrintGetContext */
 
277
        CARD16  length B16;
 
278
} xPrintGetContextReq;          
 
279
#define sz_xPrintGetContextReq          4
 
280
 
 
281
typedef struct {
 
282
        BYTE    type;                   /* X_Reply */
 
283
        CARD8   unused;                 /* not used */
 
284
        CARD16  sequenceNumber B16;
 
285
        CARD32  length B32;
 
286
        PCONTEXT printContext B32;      /* print context */
 
287
        CARD32  pad1 B32;
 
288
        CARD32  pad2 B32;
 
289
        CARD32  pad3 B32;
 
290
        CARD32  pad4 B32;
 
291
        CARD32  pad5 B32;
 
292
} xPrintGetContextReply;
 
293
#define sz_xPrintGetContextReply        32
 
294
 
 
295
 
 
296
typedef struct _PrintDestroyContext {
 
297
        CARD8   reqType;                /* always PrintReqCode */
 
298
        CARD8   printReqType;           /* always X_PrintDestroyContext */
 
299
        CARD16  length B16;
 
300
        PCONTEXT printContext B32;      /* print context */
 
301
} xPrintDestroyContextReq;              
 
302
#define sz_xPrintDestroyContextReq      8
 
303
 
 
304
 
 
305
typedef struct _PrintGetContextScreen {
 
306
        CARD8   reqType;                /* always PrintReqCode */
 
307
        CARD8   printReqType;           /* always X_PrintGetContextScreen */
 
308
        CARD16  length B16;
 
309
        PCONTEXT printContext B32;      /* print context */
 
310
} xPrintGetContextScreenReq;            
 
311
#define sz_xPrintGetContextScreenReq    8
 
312
 
 
313
typedef struct {
 
314
        BYTE    type;                   /* X_Reply */
 
315
        CARD8   unused;                 /* not used */
 
316
        CARD16  sequenceNumber B16;
 
317
        CARD32  length B32;
 
318
        WINDOW  rootWindow;             /* screenPtr represented as rootWin */
 
319
        CARD32  pad1 B32;
 
320
        CARD32  pad2 B32;
 
321
        CARD32  pad3 B32;
 
322
        CARD32  pad4 B32;
 
323
        CARD32  pad5 B32;
 
324
} xPrintGetContextScreenReply;
 
325
#define sz_xPrintGetContextScreenReply  32
 
326
 
 
327
 
 
328
typedef struct _PrintStartJob {
 
329
        CARD8   reqType;                /* always PrintReqCode */
 
330
        CARD8   printReqType;           /* always X_PrintStartJob */
 
331
        CARD16  length B16;
 
332
        CARD8   saveData;               /* save data boolean */
 
333
        CARD8   pad1;
 
334
        CARD16  pad2 B16;
 
335
} xPrintStartJobReq;            
 
336
#define sz_xPrintStartJobReq            8
 
337
 
 
338
typedef struct _PrintEndJob {
 
339
        CARD8   reqType;                /* always PrintReqCode */
 
340
        CARD8   printReqType;           /* always X_PrintEndJob */
 
341
        CARD16  length B16;
 
342
        BOOL    cancel;                 /* cancel boolean */
 
343
        CARD8   pad1;
 
344
        CARD16  pad2 B16;
 
345
} xPrintEndJobReq;
 
346
#define sz_xPrintEndJobReq              8
 
347
 
 
348
 
 
349
typedef struct _PrintStartDoc {
 
350
        CARD8   reqType;                /* always PrintReqCode */
 
351
        CARD8   printReqType;           /* always X_PrintStartDoc */
 
352
        CARD16  length B16;
 
353
        CARD8   type;                   /* type for document */
 
354
        CARD8   pad1;
 
355
        CARD16  pad2 B16;
 
356
} xPrintStartDocReq;            
 
357
#define sz_xPrintStartDocReq            8
 
358
 
 
359
typedef struct _PrintEndDoc {
 
360
        CARD8   reqType;                /* always PrintReqCode */
 
361
        CARD8   printReqType;           /* always X_PrintEndDoc */
 
362
        CARD16  length B16;
 
363
        BOOL    cancel;                 /* cancel boolean */
 
364
        CARD8   pad1;
 
365
        CARD16  pad2 B16;
 
366
} xPrintEndDocReq;
 
367
#define sz_xPrintEndDocReq              8
 
368
 
 
369
 
 
370
typedef struct _PrintPutDocumentData {
 
371
        CARD8   reqType;                /* always PrintReqCode */
 
372
        CARD8   printReqType;           /* always X_PrintPutDocumentData */
 
373
        CARD16  length B16;
 
374
        DRAWABLE drawable B32;          /* target drawable */
 
375
        CARD32  len_data B32;           /* big len in bytes */
 
376
        CARD16  len_fmt;                /* len in bytes */
 
377
        CARD16  len_options;            /* len in bytes */
 
378
 
 
379
        /* variable portion *****************************************
 
380
        LISTofBYTE      data;            * data *
 
381
        BYTE            pad(len_data)    * unused *
 
382
        STRING8         doc_fmt;         * ISO compliant desc of data type *
 
383
        BYTE            pad(len_fmt)     * unused *
 
384
        STRING8         options;         * additional device-dependent desc *
 
385
        BYTE            pad(len_options) * unused *
 
386
        ************************************************************/
 
387
} xPrintPutDocumentDataReq;
 
388
#define sz_xPrintPutDocumentDataReq     16
 
389
 
 
390
 
 
391
typedef struct _PrintGetDocumentData {
 
392
        CARD8   reqType;                /* always PrintReqCode */
 
393
        CARD8   printReqType;           /* always X_PrintGetDocumentData */
 
394
        CARD16  length B16;
 
395
        PCONTEXT printContext B32;      /* print context */
 
396
        CARD32  maxBufferSize B32;      /* maximum buffer size requested */
 
397
} xPrintGetDocumentDataReq;             
 
398
#define sz_xPrintGetDocumentDataReq     12
 
399
 
 
400
typedef struct {
 
401
        BYTE    type;                   /* X_Reply */
 
402
        CARD8   unused;                 /* not used */
 
403
        CARD16  sequenceNumber B16;
 
404
        CARD32  length B32;
 
405
        CARD32  statusCode B32;         /* status code for reply */
 
406
        CARD32  finishedFlag B32;       /* is this the last reply */
 
407
        CARD32  dataLen B32;            /* data length */
 
408
        CARD32  pad1 B32;
 
409
        CARD32  pad2 B32;
 
410
        CARD32  pad3 B32;
 
411
 
 
412
        /* variable portion *****************************************
 
413
        LISTofBYTE      data;            * data *
 
414
        BYTE            pad(count)       * unused *
 
415
        ************************************************************/
 
416
} xPrintGetDocumentDataReply;
 
417
#define sz_xPrintGetDocumentDataReply   32
 
418
 
 
419
 
 
420
typedef struct _PrintStartPage {
 
421
        CARD8   reqType;                /* always PrintReqCode */
 
422
        CARD8   printReqType;           /* always X_PrintStartPage */
 
423
        CARD16  length B16;
 
424
        WINDOW  window B32;             /* window */
 
425
} xPrintStartPageReq;           
 
426
#define sz_xPrintStartPageReq           8
 
427
 
 
428
typedef struct _PrintEndPage {
 
429
        CARD8   reqType;                /* always PrintReqCode */
 
430
        CARD8   printReqType;           /* always X_PrintEndPage */
 
431
        CARD16  length B16;
 
432
        BOOL    cancel;                 /* cancel boolean */
 
433
        CARD8   pad1;
 
434
        CARD16  pad2 B16;
 
435
} xPrintEndPageReq;
 
436
#define sz_xPrintEndPageReq             8
 
437
 
 
438
 
 
439
typedef struct _PrintSelectInput {
 
440
        CARD8   reqType;                /* always PrintReqCode */
 
441
        CARD8   printReqType;           /* always X_PrintSelectInput */
 
442
        CARD16  length B16;
 
443
        PCONTEXT printContext B32;      /* print context */
 
444
        BITMASK eventMask B32;
 
445
} xPrintSelectInputReq;
 
446
#define sz_xPrintSelectInputReq         12
 
447
 
 
448
 
 
449
typedef struct _PrintInputSelected {
 
450
        CARD8   reqType;                /* always PrintReqCode */
 
451
        CARD8   printReqType;           /* always X_PrintInputSelected */
 
452
        CARD16  length B16;
 
453
        PCONTEXT printContext B32;      /* print context */
 
454
} xPrintInputSelectedReq;
 
455
#define sz_xPrintInputSelectedReq       8
 
456
 
 
457
typedef struct {
 
458
        BYTE    type;                   /* X_Reply */
 
459
        CARD8   unused;                 /* not used */
 
460
        CARD16  sequenceNumber B16;
 
461
        CARD32  length B32;
 
462
        BITMASK eventMask B32;          /* your event mask */
 
463
        BITMASK allEventsMask B32;      /* all event mask */
 
464
        CARD32  pad1 B32;
 
465
        CARD32  pad2 B32;
 
466
        CARD32  pad3 B32;
 
467
        CARD32  pad4 B32;
 
468
} xPrintInputSelectedReply;
 
469
#define sz_xPrintInputSelectedReply     32
 
470
 
 
471
typedef struct _PrintGetAttributes {
 
472
        CARD8   reqType;                /* always PrintReqCode */
 
473
        CARD8   printReqType;           /* always X_PrintGetAttributes */
 
474
        CARD16  length B16;
 
475
        PCONTEXT printContext B32;      /* print context */
 
476
        CARD8   type;                   /* type */
 
477
        CARD8   pad1;                   /* unused */
 
478
        CARD16  pad2 B16;               /* unused */
 
479
} xPrintGetAttributesReq;
 
480
#define sz_xPrintGetAttributesReq       12
 
481
 
 
482
typedef struct {
 
483
        BYTE    type;                   /* X_Reply */
 
484
        CARD8   unused;                 /* not used */
 
485
        CARD16  sequenceNumber B16;
 
486
        CARD32  length B32;
 
487
        CARD32  stringLen B32;          /* length of xrm db string */
 
488
        CARD32  pad1 B32;
 
489
        CARD32  pad2 B32;
 
490
        CARD32  pad3 B32;
 
491
        CARD32  pad4 B32;
 
492
        CARD32  pad5 B32;
 
493
 
 
494
        /* variable portion *****************************************
 
495
        STRING8 string;                  * xrm db as a string *
 
496
        BYTE    pad(stringLen)           * unused *
 
497
        ************************************************************/
 
498
} xPrintGetAttributesReply;
 
499
#define sz_xPrintGetAttributesReply     32
 
500
 
 
501
 
 
502
typedef struct _PrintSetAttributes {
 
503
        CARD8   reqType;                /* always PrintReqCode */
 
504
        CARD8   printReqType;           /* always X_PrintSetAttributes */
 
505
        CARD16  length B16;
 
506
        PCONTEXT printContext B32;      /* print context */
 
507
        CARD32  stringLen B32;          /* length of xrm db string */
 
508
        CARD8   type;                   /* type */
 
509
        CARD8   rule;                   /* replacement rule */
 
510
        CARD16  pad1 B16;               /* unused */
 
511
 
 
512
        /* variable portion *****************************************
 
513
        STRING8 string;                  * xrm db as a string *
 
514
        BYTE    pad(stringLen)           * unused *
 
515
        ************************************************************/
 
516
} xPrintSetAttributesReq;
 
517
#define sz_xPrintSetAttributesReq       16
 
518
 
 
519
 
 
520
typedef struct _PrintGetOneAttribute {
 
521
        CARD8   reqType;                /* always PrintReqCode */
 
522
        CARD8   printReqType;           /* always X_PrintGetOneAttribute */
 
523
        CARD16  length B16;
 
524
        PCONTEXT printContext B32;      /* print context */
 
525
        CARD32  nameLen;                /* length of name string */
 
526
        CARD8   type;                   /* type */
 
527
        CARD8   pad1;                   /* unused */
 
528
        CARD16  pad2 B16;               /* unused */
 
529
 
 
530
        /* variable portion *****************************************
 
531
        STRING8 name;                    * name as a string *
 
532
        BYTE    pad(name)                * unused *
 
533
        ************************************************************/
 
534
} xPrintGetOneAttributeReq;
 
535
#define sz_xPrintGetOneAttributeReq     16
 
536
 
 
537
typedef struct {
 
538
        BYTE    type;                   /* X_Reply */
 
539
        CARD8   unused;                 /* not used */
 
540
        CARD16  sequenceNumber B16;
 
541
        CARD32  length B32;
 
542
        CARD32  valueLen B32;           /* length of value string */
 
543
        CARD32  pad1 B32;
 
544
        CARD32  pad2 B32;
 
545
        CARD32  pad3 B32;
 
546
        CARD32  pad4 B32;
 
547
        CARD32  pad5 B32;
 
548
 
 
549
        /* variable portion *****************************************
 
550
        STRING8 value;                   * value as a string *
 
551
        BYTE    pad(value)               * unused *
 
552
        ************************************************************/
 
553
} xPrintGetOneAttributeReply;
 
554
#define sz_xPrintGetOneAttributeReply   32
 
555
 
 
556
 
 
557
typedef struct _PrintGetPageDimensions {
 
558
        CARD8   reqType;                /* always PrintReqCode */
 
559
        CARD8   printReqType;           /* always X_PrintGetPageDimensions */
 
560
        CARD16  length B16;
 
561
        PCONTEXT printContext B32;      /* print context */
 
562
} xPrintGetPageDimensionsReq;           
 
563
#define sz_xPrintGetPageDimensionsReq   8
 
564
 
 
565
typedef struct {
 
566
        BYTE    type;                   /* X_Reply */
 
567
        CARD8   unused;                 /* not used */
 
568
        CARD16  sequenceNumber B16;
 
569
        CARD32  length B32;
 
570
        CARD16  width;                  /* total pixel width */
 
571
        CARD16  height;                 /* total pixel height */
 
572
        CARD16  rx;                     /* reproducable x pixel offset */
 
573
        CARD16  ry;                     /* reproducable y pixel offset */
 
574
        CARD16  rwidth;                 /* reproducable x pixel width */
 
575
        CARD16  rheight;                /* reproducable y pixel width */
 
576
        CARD32  pad1 B32;
 
577
        CARD32  pad2 B32;
 
578
        CARD32  pad3 B32;
 
579
} xPrintGetPageDimensionsReply;
 
580
#define sz_xPrintGetPageDimensionsReply 32
 
581
 
 
582
 
 
583
typedef struct _PrintQueryScreens {
 
584
        CARD8   reqType;                /* always PrintReqCode */
 
585
        CARD8   printReqType;           /* always X_PrintQueryScreens */
 
586
        CARD16  length B16;
 
587
} xPrintQueryScreensReq;                
 
588
#define sz_xPrintQueryScreensReq        4
 
589
 
 
590
typedef struct {
 
591
        BYTE    type;                   /* X_Reply */
 
592
        CARD8   unused;                 /* not used */
 
593
        CARD16  sequenceNumber B16;
 
594
        CARD32  length B32;
 
595
        CARD32  listCount;              /* number of screens following */
 
596
        CARD32  pad1 B32;
 
597
        CARD32  pad2 B32;
 
598
        CARD32  pad3 B32;
 
599
        CARD32  pad4 B32;
 
600
        CARD32  pad5 B32;
 
601
 
 
602
        /* variable portion *****************************************
 
603
        WINDOW  rootWindow;              * root window of screen *
 
604
        ************************************************************/
 
605
} xPrintQueryScreensReply;
 
606
#define sz_xPrintQueryScreensReply      32
 
607
 
 
608
typedef struct _PrintSetImageResolution {
 
609
        CARD8   reqType;                /* always PrintReqCode */
 
610
        CARD8   printReqType;           /* always X_PrintSetImageResolution */
 
611
        CARD16  length B16;
 
612
        PCONTEXT printContext B32;      /* print context */
 
613
        CARD16 imageRes B16;            /* image resolution */
 
614
        CARD16 pad1 B16;
 
615
} xPrintSetImageResolutionReq;
 
616
#define sz_xPrintSetImageResolutionReq  12
 
617
 
 
618
typedef struct {
 
619
        BYTE    type;                   /* X_Reply */
 
620
        BOOL    status;                 /* accepted or not */
 
621
        CARD16  sequenceNumber B16;
 
622
        CARD32  length B32;
 
623
        CARD16  prevRes B16;            /* previous resolution */
 
624
        CARD16  pad1 B32;
 
625
        CARD32  pad2 B32;
 
626
        CARD32  pad3 B32;
 
627
        CARD32  pad4 B32;
 
628
        CARD32  pad5 B32;
 
629
        CARD32  pad6 B32;
 
630
} xPrintSetImageResolutionReply;
 
631
#define sz_xPrintSetImageResolutionReply 32
 
632
 
 
633
typedef struct _PrintGetImageResolution {
 
634
        CARD8   reqType;                /* always PrintReqCode */
 
635
        CARD8   printReqType;           /* always X_PrintGetImageResolution */
 
636
        CARD16  length B16;
 
637
        PCONTEXT printContext B32;      /* print context */
 
638
} xPrintGetImageResolutionReq;
 
639
#define sz_xPrintGetImageResolutionReq  8
 
640
 
 
641
typedef struct {
 
642
        BYTE    type;                   /* X_Reply */
 
643
        CARD8   unused;
 
644
        CARD16  sequenceNumber B16;
 
645
        CARD32  length B32;
 
646
        CARD16  imageRes B16;           /* image resolution */
 
647
        CARD16  pad1 B32;
 
648
        CARD32  pad2 B32;
 
649
        CARD32  pad3 B32;
 
650
        CARD32  pad4 B32;
 
651
        CARD32  pad5 B32;
 
652
        CARD32  pad6 B32;
 
653
} xPrintGetImageResolutionReply;
 
654
#define sz_xPrintGetImageResolutionReply 32
 
655
 
 
656
#ifndef _XP_PRINT_SERVER_
 
657
/***********************************************************************
 
658
 *
 
659
 * Library-only definitions.
 
660
 */
 
661
extern XPHinterProc  _xp_hinter_proc;
 
662
extern char         *_xp_hinter_desc;
 
663
extern int           _xp_hinter_init;
 
664
 
 
665
#else /* _XP_PRINT_SERVER_ */
 
666
 
 
667
/***********************************************************************
 
668
 *
 
669
 * Server-only definitions shared between the extension and DDX layers.
 
670
 *
 
671
 */
 
672
 
 
673
/*
 
674
 * Internal return code used to indicate that the requesting
 
675
 * client has been suspended.
 
676
 */
 
677
#define Suspended 84
 
678
 
 
679
struct _XpContext;
 
680
 
 
681
extern void XpRegisterPrinterScreen(
 
682
    ScreenPtr pScreen,
 
683
    int (*CreateContext)(struct _XpContext *));
 
684
 
 
685
typedef struct _xpprintFuncs {
 
686
    int (*StartJob)(
 
687
        struct _XpContext *     /* pContext */,
 
688
        Bool                    /* sendClientData */,
 
689
        ClientPtr               /* client */);
 
690
    int (*EndJob)(struct _XpContext *, int);
 
691
    int (*StartDoc)(
 
692
        struct _XpContext *     /* pContext */,
 
693
        XPDocumentType          /* type */);
 
694
    int (*EndDoc)(struct _XpContext *, int);
 
695
    int (*StartPage)(
 
696
        struct _XpContext *     /* pContext */,
 
697
        WindowPtr               /* pWin */);
 
698
    int (*EndPage)(
 
699
        struct _XpContext *     /* pContext */,
 
700
        WindowPtr               /* pWin */);
 
701
    int (*PutDocumentData)(
 
702
        struct _XpContext *     /* pContext */,
 
703
        DrawablePtr             /* pDraw */,
 
704
        char *                  /* pData */,
 
705
        int                     /* len_data */,
 
706
        char *                  /* pDoc_fmt */,
 
707
        int                     /* len_fmt */,
 
708
        char *                  /* pOptions */,
 
709
        int                     /* len_options */,
 
710
        ClientPtr               /* client */);
 
711
    int (*GetDocumentData)(
 
712
        struct _XpContext *     /* pContext */,
 
713
        ClientPtr               /* client */,
 
714
        int                     /* maxBufferSize */);
 
715
    int (*DestroyContext)(
 
716
        struct _XpContext *);   /* pContext */
 
717
    char *(*GetAttributes)(
 
718
        struct _XpContext *,
 
719
        XPAttributes            /* pool */);
 
720
    char *(*GetOneAttribute)(
 
721
        struct _XpContext *     /* pContext */,
 
722
        XPAttributes            /* pool */,
 
723
        char *                  /* attrs */);
 
724
    int (*SetAttributes)(
 
725
        struct _XpContext *     /* pContext */,
 
726
        XPAttributes            /* pool */,
 
727
        char *                  /* attrs */);
 
728
    int (*AugmentAttributes)(
 
729
        struct _XpContext *     /* pContext */,
 
730
        XPAttributes            /* pool */,
 
731
        char *                  /* attrs */);
 
732
    int (*GetMediumDimensions)(
 
733
        struct _XpContext *     /* pPrintContext */,
 
734
        CARD16 *                /* pWidth */,
 
735
        CARD16 *                /* pHeight */);
 
736
    int (*GetReproducibleArea)(
 
737
        struct _XpContext *     /* pPrintContext */,
 
738
        xRectangle *            /* pRect */);
 
739
    int (*SetImageResolution)(
 
740
        struct _XpContext *     /* pPrintContext */,
 
741
        int                     /* imageRes */,
 
742
        Bool *                  /* pStatus */);
 
743
} XpDriverFuncs, *XpDriverFuncsPtr;
 
744
 
 
745
/*
 
746
 * Each print context is represented by one of the following structs
 
747
 * associated with a resource ID of type RTcontext .  A pointer to
 
748
 * the context is placed in the Xp extension's devPrivates
 
749
 * element in each client * which establishes a context via
 
750
 * either initContext or setContext.
 
751
 * The context pointer is also placed in the struct indicated by the
 
752
 * RTpage resource associated with each StartPage'd window.
 
753
 */
 
754
typedef struct _XpContext {
 
755
        XID contextID;
 
756
        char *printerName;
 
757
        int screenNum;          /* screen containing the printer */
 
758
        struct _XpClient *clientHead; /* list of clients */
 
759
        CARD32 state;
 
760
        VisualID pageWin;
 
761
        DevUnion *devPrivates;
 
762
        XpDriverFuncs funcs;
 
763
        ClientPtr clientSlept;
 
764
        int imageRes;
 
765
} XpContextRec, *XpContextPtr;
 
766
 
 
767
#include "fontstruct.h" /* FontResolutionPtr */
 
768
 
 
769
extern Bool XpAllocateContextPrivate(int, unsigned);
 
770
extern FontResolutionPtr XpGetClientResolutions(ClientPtr, int *);
 
771
extern XpContextPtr XpContextOfClient(ClientPtr);
 
772
extern XpContextPtr XpGetPrintContext(ClientPtr);
 
773
extern int XpAllocateContextPrivateIndex(void);
 
774
extern int XpRehashPrinterList(void);
 
775
extern void XpSetFontResFunc(ClientPtr);
 
776
extern void XpUnsetFontResFunc(ClientPtr);
 
777
extern void XpRegisterInitFunc(ScreenPtr, char *, int (*)(struct _XpContext *));
 
778
 
 
779
#endif /* _XP_PRINT_SERVER_ */
 
780
 
 
781
_XFUNCPROTOEND
 
782
 
 
783
#endif /* _XpPrintstr_H_ */