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

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/sunLynx/sun.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: sun.h,v 1.3 2000/08/17 19:48:36 cpqbld Exp $ */
 
2
 
 
3
/* This is sun.h modified for LynxOS */
 
4
 
 
5
/*-
 
6
 * Copyright (c) 1987 by the Regents of the University of California
 
7
 *
 
8
 * Permission to use, copy, modify, and distribute this
 
9
 * software and its documentation for any purpose and without
 
10
 * fee is hereby granted, provided that the above copyright
 
11
 * notice appear in all copies.  The University of California
 
12
 * makes no representations about the suitability of this
 
13
 * software for any purpose.  It is provided "as is" without
 
14
 * express or implied warranty.
 
15
 */
 
16
/* $XFree86: xc/programs/Xserver/hw/sunLynx/sun.h,v 3.7 2001/07/25 15:05:02 dawes Exp $ */
 
17
 
 
18
#ifndef _SUN_H_ 
 
19
#define _SUN_H_
 
20
 
 
21
/* X headers */
 
22
#include "Xos.h"
 
23
#undef index /* don't mangle silly Sun structure member names */
 
24
#include "X.h"
 
25
#include "Xproto.h"
 
26
 
 
27
/* general system headers */
 
28
#ifndef NOSTDHDRS
 
29
# include <stdlib.h>
 
30
#else
 
31
# include <malloc.h>
 
32
extern char *getenv();
 
33
#endif
 
34
 
 
35
/* system headers common to both SunOS and Solaris */
 
36
#include <sys/param.h>
 
37
#include <sys/file.h>
 
38
#ifndef Lynx
 
39
# include <sys/filio.h>
 
40
#else
 
41
# include <sys/termio.h>        /* include this before ioctl.h ... */
 
42
#endif
 
43
#include <sys/ioctl.h>
 
44
#include <sys/resource.h>
 
45
 
 
46
#ifdef SVR4
 
47
# ifdef X_POSIX_C_SOURCE
 
48
#  define _POSIX_C_SOURCE X_POSIX_C_SOURCE
 
49
#  include <signal.h>
 
50
#  undef _POSIX_C_SOURCE
 
51
# else
 
52
#  define _POSIX_SOURCE
 
53
#  include <signal.h>
 
54
#  undef _POSIX_SOURCE
 
55
# endif
 
56
#endif
 
57
 
 
58
#include <fcntl.h>
 
59
 
 
60
#ifndef __bsdi__
 
61
# if !defined(__NetBSD__) && !defined(__OpenBSD__)
 
62
#  ifndef Lynx
 
63
#   ifndef i386
 
64
#    include <poll.h>
 
65
#   else
 
66
#    include <sys/poll.h>
 
67
#   endif
 
68
#  endif
 
69
# endif
 
70
#else
 
71
# include <unistd.h>
 
72
#endif
 
73
 
 
74
#include <errno.h>
 
75
#include <memory.h>
 
76
 
 
77
/* 
 
78
 * Sun specific headers Sun moved in Solaris, and are different for NetBSD.
 
79
 *
 
80
 * Even if only needed by one source file, I have put them here 
 
81
 * to simplify finding them...
 
82
 */
 
83
#ifdef SVR4
 
84
# include <sys/fbio.h>
 
85
# include <sys/kbd.h>
 
86
# include <sys/kbio.h>
 
87
# include <sys/msio.h>
 
88
# include <sys/vuid_event.h>
 
89
# include <sys/memreg.h>
 
90
# include <stropts.h>
 
91
# define usleep(usec) poll((struct pollfd *) 0, (size_t) 0, usec / 1000)
 
92
#else
 
93
# if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(Lynx)
 
94
#  include <sun/fbio.h>
 
95
#  include <sundev/kbd.h>
 
96
#  include <sundev/kbio.h>
 
97
#  include <sundev/msio.h>
 
98
#  include <sundev/vuid_event.h>
 
99
#  include <pixrect/pixrect.h>
 
100
#  include <pixrect/memreg.h>
 
101
extern int ioctl();
 
102
extern int getrlimit();
 
103
extern int setrlimit();
 
104
extern int getpagesize();
 
105
# else
 
106
#  if defined (__NetBSD__) || defined (__OpenBSD__)
 
107
#   include <machine/fbio.h>
 
108
#   include <machine/kbd.h>
 
109
#   include <machine/kbio.h>
 
110
#   include <machine/vuid_event.h>
 
111
#  endif
 
112
#  ifdef __bsdi__
 
113
#   include <sys/fbio.h>
 
114
#   include </sys/sparc/dev/kbd.h>
 
115
#   include </sys/sparc/dev/kbio.h>
 
116
#   include </sys/sparc/dev/vuid_event.h>
 
117
#  endif
 
118
#  ifdef Lynx
 
119
#   ifndef __P
 
120
#    define __P(x)      x
 
121
#   endif
 
122
#   include <signal.h>
 
123
#   ifdef PATCHED_CONSOLE
 
124
#    include <kbio.h>
 
125
#    include <kbd.h>
 
126
#   else
 
127
#    define KB_SUN2             2               /* type 2 keyboard */
 
128
#    define KB_SUN3             3               /* type 3 keyboard */
 
129
#    define KB_SUN4             4               /* type 4 keyboard */
 
130
#    define KIOCSLED            TIOCLED
 
131
#    define LED_NUM_LOCK        NUM_LOCK
 
132
#    define LED_SCROLL_LOCK     SCROL_LOCK
 
133
#    define LED_CAPS_LOCK       CAPS_LOCK
 
134
#    define LED_COMPOSE         COMPOSE_LED
 
135
#   endif
 
136
#   include <smem.h>
 
137
#   include "fbio.h"
 
138
#   include "vuid_event.h"
 
139
#   define FBIORESET    _IO('F', 29)
 
140
#  endif
 
141
# endif
 
142
#endif
 
143
extern int gettimeofday();
 
144
 
 
145
/* 
 
146
 * Server specific headers
 
147
 */
 
148
#include "misc.h"
 
149
#undef abs /* don't munge function prototypes in headers, sigh */
 
150
#include "scrnintstr.h"
 
151
#ifdef NEED_EVENTS
 
152
# include "inputstr.h"
 
153
#endif
 
154
#include "input.h"
 
155
#include "colormapst.h"
 
156
#include "colormap.h"
 
157
#include "cursorstr.h"
 
158
#include "cursor.h"
 
159
#include "dixstruct.h"
 
160
#include "dix.h"
 
161
#include "opaque.h"
 
162
#include "resource.h"
 
163
#include "servermd.h"
 
164
#include "windowstr.h"
 
165
 
 
166
/* 
 
167
 * ddx specific headers 
 
168
 */
 
169
#ifndef PSZ
 
170
#define PSZ 8
 
171
#endif
 
172
 
 
173
#include "mi/mibstore.h"
 
174
#include "mi/mipointer.h"
 
175
 
 
176
extern int monitorResolution;
 
177
 
 
178
 
 
179
/* Frame buffer devices */
 
180
#ifdef SVR4
 
181
# define CGTWO0DEV      "/dev/fbs/cgtwo0"
 
182
# define CGTWO1DEV      "/dev/fbs/cgtwo1"
 
183
# define CGTWO2DEV      "/dev/fbs/cgtwo2"
 
184
# define CGTWO3DEV      "/dev/fbs/cgtwo3"
 
185
# define CGTHREE0DEV    "/dev/fbs/cgthree0"
 
186
# define CGTHREE1DEV    "/dev/fbs/cgthree1"
 
187
# define CGTHREE2DEV    "/dev/fbs/cgthree2"
 
188
# define CGTHREE3DEV    "/dev/fbs/cgthree3"
 
189
# define CGFOUR0DEV     "/dev/fbs/cgfour0"
 
190
# define CGSIX0DEV      "/dev/fbs/cgsix0"
 
191
# define CGSIX1DEV      "/dev/fbs/cgsix1"
 
192
# define CGSIX2DEV      "/dev/fbs/cgsix2"
 
193
# define CGSIX3DEV      "/dev/fbs/cgsix3"
 
194
# define BWTWO0DEV      "/dev/fbs/bwtwo0"
 
195
# define BWTWO1DEV      "/dev/fbs/bwtwo1"
 
196
# define BWTWO2DEV      "/dev/fbs/bwtwo2"
 
197
# define BWTWO3DEV      "/dev/fbs/bwtwo3"
 
198
# define CGEIGHT0DEV    "/dev/fbs/cgeight0"
 
199
#else
 
200
# define CGTWO0DEV      "/dev/cgtwo0"
 
201
# define CGTWO1DEV      "/dev/cgtwo1"
 
202
# define CGTWO2DEV      "/dev/cgtwo2"
 
203
# define CGTWO3DEV      "/dev/cgtwo3"
 
204
# define CGTHREE0DEV    "/dev/cgthree0"
 
205
# define CGTHREE1DEV    "/dev/cgthree1"
 
206
# define CGTHREE2DEV    "/dev/cgthree2"
 
207
# define CGTHREE3DEV    "/dev/cgthree3"
 
208
# define CGFOUR0DEV     "/dev/cgfour0"
 
209
# define CGSIX0DEV      "/dev/cgsix0"
 
210
# define CGSIX1DEV      "/dev/cgsix1"
 
211
# define CGSIX2DEV      "/dev/cgsix2"
 
212
# define CGSIX3DEV      "/dev/cgsix3"
 
213
# define BWTWO0DEV      "/dev/bwtwo0"
 
214
# define BWTWO1DEV      "/dev/bwtwo1"
 
215
# define BWTWO2DEV      "/dev/bwtwo2"
 
216
# define BWTWO3DEV      "/dev/bwtwo3"
 
217
# define CGEIGHT0DEV    "/dev/cgeight0"
 
218
#endif
 
219
 
 
220
/*
 
221
 * MAXEVENTS is the maximum number of events the mouse and keyboard functions
 
222
 * will read on a given call to their GetEvents vectors.
 
223
 */
 
224
#ifndef Lynx
 
225
#define MAXEVENTS       32
 
226
#else
 
227
/* currently our mouse stuff is pretty naive, so we need a lot of events */
 
228
#define MAXEVENTS       256
 
229
#endif
 
230
 
 
231
/*
 
232
 * Data private to any sun keyboard.
 
233
 */
 
234
typedef struct {
 
235
    int         fd;
 
236
    int         type;           /* Type of keyboard */
 
237
    int         layout;         /* The layout of the keyboard */
 
238
    int         click;          /* kbd click save state */
 
239
    Leds        leds;           /* last known LED state */
 
240
} sunKbdPrivRec, *sunKbdPrivPtr;
 
241
 
 
242
extern sunKbdPrivRec sunKbdPriv;
 
243
 
 
244
/*
 
245
 * Data private to any sun pointer device.
 
246
 */
 
247
typedef struct {
 
248
    int         fd;
 
249
    int         bmask;          /* last known button state */
 
250
} sunPtrPrivRec, *sunPtrPrivPtr;
 
251
 
 
252
extern sunPtrPrivRec sunPtrPriv;
 
253
 
 
254
typedef struct {
 
255
    BYTE        key;
 
256
    CARD8       modifiers;
 
257
} SunModmapRec;
 
258
 
 
259
typedef struct {
 
260
    int             width, height;
 
261
    Bool            has_cursor;
 
262
    CursorPtr       pCursor;            /* current cursor */
 
263
} sunCursorRec, *sunCursorPtr;
 
264
 
 
265
typedef struct {
 
266
    ColormapPtr     installedMap;
 
267
    CloseScreenProcPtr CloseScreen;
 
268
    void            (*UpdateColormap)();
 
269
    sunCursorRec    hardwareCursor;
 
270
    Bool            hasHardwareCursor;
 
271
} sunScreenRec, *sunScreenPtr;
 
272
 
 
273
#define GetScreenPrivate(s)   ((sunScreenPtr) ((s)->devPrivates[sunScreenIndex].ptr))
 
274
#define SetupScreen(s)  sunScreenPtr    pPrivate = GetScreenPrivate(s)
 
275
 
 
276
typedef struct {
 
277
#ifndef Lynx
 
278
    unsigned char*  fb;         /* Frame buffer itself */
 
279
#else
 
280
    unsigned char*  fbuf;       /* Frame buffer itself */
 
281
    void*           ramdac;     /* Color LookUp table */
 
282
    void*           fb;         /* GX FB control registers: 
 
283
                                 * sunGX.c relies on this name
 
284
                                 */
 
285
    void*           tec;        /* GX TEC registers */
 
286
    void*           thc;        /* GX THC registers */
 
287
    void*           fhc;        /* GX FHC registers */
 
288
#endif
 
289
    int             fd;         /* frame buffer for ioctl()s, */
 
290
    struct fbtype   info;       /* Frame buffer characteristics */
 
291
    void            (*EnterLeave)();/* screen switch */
 
292
    unsigned char*  fbPriv;     /* fbattr stuff, for the real type */
 
293
} fbFd;
 
294
 
 
295
typedef Bool (*sunFbInitProc)(
 
296
#if NeedFunctionPrototypes
 
297
    int /* screen */,
 
298
    ScreenPtr /* pScreen */,
 
299
    int /* argc */,
 
300
    char** /* argv */
 
301
#endif
 
302
);
 
303
 
 
304
typedef struct {
 
305
    sunFbInitProc       init;   /* init procedure for this fb */
 
306
    char*               name;   /* /usr/include/fbio names */
 
307
} sunFbDataRec;
 
308
 
 
309
#ifdef XKB
 
310
extern Bool             noXkbExtension;
 
311
#endif
 
312
 
 
313
extern Bool             sunAutoRepeatHandlersInstalled;
 
314
extern long             sunAutoRepeatInitiate;
 
315
extern long             sunAutoRepeatDelay;
 
316
extern sunFbDataRec     sunFbData[];
 
317
extern fbFd             sunFbs[];
 
318
extern Bool             sunSwapLkeys;
 
319
extern Bool             sunFlipPixels;
 
320
extern Bool             sunActiveZaphod;
 
321
extern Bool             sunFbInfo;
 
322
extern Bool             sunCG4Frob;
 
323
extern Bool             sunNoGX;
 
324
extern int              sunScreenIndex;
 
325
extern int*             sunProtected;
 
326
 
 
327
extern Bool sunCursorInitialize(
 
328
#if NeedFunctionPrototypes
 
329
    ScreenPtr /* pScreen */
 
330
#endif
 
331
);
 
332
 
 
333
extern void sunDisableCursor(
 
334
#if NeedFunctionPrototypes
 
335
    ScreenPtr /* pScreen */
 
336
#endif
 
337
);
 
338
 
 
339
extern int sunChangeKbdTranslation(
 
340
#if NeedFunctionPrototypes
 
341
    int /* fd */,
 
342
    Bool /* makeTranslated */
 
343
#endif
 
344
);
 
345
 
 
346
extern void sunNonBlockConsoleOff(
 
347
#if NeedFunctionPrototypes
 
348
#if defined(SVR4) || defined(CSRG_BASED) || defined(Lynx)
 
349
    void
 
350
#else
 
351
    char* /* arg */
 
352
#endif
 
353
#endif
 
354
);
 
355
 
 
356
extern void sunEnqueueEvents(
 
357
#if NeedFunctionPrototypes
 
358
    void
 
359
#endif
 
360
);
 
361
 
 
362
extern void sunEnqueueKbdEvents(
 
363
#if NeedFunctionPrototypes
 
364
    void
 
365
#endif
 
366
);
 
367
 
 
368
extern void sunEnqueueMseEvents(
 
369
#if NeedFunctionPrototypes
 
370
    void
 
371
#endif
 
372
);
 
373
 
 
374
extern int sunGXInit(
 
375
#if NeedFunctionPrototypes
 
376
    ScreenPtr /* pScreen */,
 
377
    fbFd* /* fb */
 
378
#endif
 
379
);
 
380
 
 
381
extern Bool sunSaveScreen(
 
382
#if NeedFunctionPrototypes
 
383
    ScreenPtr /* pScreen */,
 
384
    int /* on */
 
385
#endif
 
386
);
 
387
 
 
388
extern Bool sunScreenInit(
 
389
#if NeedFunctionPrototypes
 
390
    ScreenPtr /* pScreen */
 
391
#endif
 
392
);
 
393
 
 
394
extern pointer sunMemoryMap(
 
395
#if NeedFunctionPrototypes
 
396
    size_t /* len */,
 
397
    off_t /* off */,
 
398
    int /* fd */
 
399
#ifdef Lynx
 
400
    , char * /* name */
 
401
#endif
 
402
#endif
 
403
);
 
404
 
 
405
extern Bool sunScreenAllocate(
 
406
#if NeedFunctionPrototypes
 
407
    ScreenPtr /* pScreen */
 
408
#endif
 
409
);
 
410
 
 
411
extern Bool sunInitCommon(
 
412
#if NeedFunctionPrototypes
 
413
    int /* scrn */,
 
414
    ScreenPtr /* pScrn */,
 
415
    off_t /* offset */,
 
416
    Bool (* /* init1 */)(),
 
417
    void (* /* init2 */)(),
 
418
    Bool (* /* cr_cm */)(),
 
419
    Bool (* /* save */)(),
 
420
    int /* fb_off */
 
421
#endif
 
422
);
 
423
 
 
424
extern Firm_event* sunKbdGetEvents(
 
425
#if NeedFunctionPrototypes
 
426
    int /* fd */,
 
427
    Bool /* on */,
 
428
    int* /* pNumEvents */,
 
429
    Bool* /* pAgain */
 
430
#endif
 
431
);
 
432
 
 
433
extern Firm_event* sunMouseGetEvents(
 
434
#if NeedFunctionPrototypes
 
435
    int /* fd */,
 
436
    Bool /* on */,
 
437
    int* /* pNumEvents */,
 
438
    Bool* /* pAgain */
 
439
#endif
 
440
);
 
441
 
 
442
extern void sunKbdEnqueueEvent(
 
443
#if NeedFunctionPrototypes
 
444
    DeviceIntPtr /* device */,
 
445
    Firm_event* /* fe */
 
446
#endif
 
447
);
 
448
 
 
449
extern void sunMouseEnqueueEvent(
 
450
#if NeedFunctionPrototypes
 
451
    DeviceIntPtr /* device */,
 
452
    Firm_event* /* fe */
 
453
#endif
 
454
);
 
455
 
 
456
extern int sunKbdProc(
 
457
#if NeedFunctionPrototypes
 
458
    DeviceIntPtr /* pKeyboard */,
 
459
    int /* what */
 
460
#endif
 
461
);
 
462
 
 
463
extern int sunMouseProc(
 
464
#if NeedFunctionPrototypes
 
465
    DeviceIntPtr /* pMouse */,
 
466
    int /* what */
 
467
#endif
 
468
);
 
469
 
 
470
extern void sunKbdWait(
 
471
#if NeedFunctionPrototypes
 
472
    void
 
473
#endif
 
474
);
 
475
 
 
476
/*-
 
477
 * TVTOMILLI(tv)
 
478
 *      Given a struct timeval, convert its time into milliseconds...
 
479
 */
 
480
#define TVTOMILLI(tv)   (((tv).tv_usec/1000)+((tv).tv_sec*1000))
 
481
 
 
482
extern Bool sunCfbSetupScreen(
 
483
#if NeedFunctionPrototypes
 
484
    ScreenPtr /* pScreen */,
 
485
    pointer /* pbits */,        /* pointer to screen bitmap */
 
486
    int /* xsize */,            /* in pixels */
 
487
    int /* ysize */,
 
488
    int /* dpix */,             /* dots per inch */
 
489
    int /* dpiy */,             /* dots per inch */
 
490
    int /* width */,            /* pixel width of frame buffer */
 
491
    int /* bpp */               /* bits per pixel of root */
 
492
#endif
 
493
);
 
494
 
 
495
extern Bool sunCfbFinishScreenInit(
 
496
#if NeedFunctionPrototypes
 
497
    ScreenPtr /* pScreen */,
 
498
    pointer /* pbits */,        /* pointer to screen bitmap */
 
499
    int /* xsize */,            /* in pixels */
 
500
    int /* ysize */,
 
501
    int /* dpix */,             /* dots per inch */
 
502
    int /* dpiy */,             /* dots per inch */
 
503
    int /* width */,            /* pixel width of frame buffer */
 
504
    int /* bpp */               /* bits per pixel of root */
 
505
#endif
 
506
);
 
507
 
 
508
extern Bool sunCfbScreenInit(
 
509
#if NeedFunctionPrototypes
 
510
    ScreenPtr /* pScreen */,
 
511
    pointer /* pbits */,        /* pointer to screen bitmap */
 
512
    int /* xsize */,            /* in pixels */
 
513
    int /* ysize */,
 
514
    int /* dpix */,             /* dots per inch */
 
515
    int /* dpiy */,             /* dots per inch */
 
516
    int /* width */,            /* pixel width of frame buffer */
 
517
    int /* bpp */               /* bits per pixel of root */
 
518
#endif
 
519
);
 
520
 
 
521
extern void sunInstallColormap(
 
522
#if NeedFunctionPrototypes
 
523
    ColormapPtr /* cmap */
 
524
#endif
 
525
);
 
526
 
 
527
extern void sunUninstallColormap(
 
528
#if NeedFunctionPrototypes
 
529
    ColormapPtr /* cmap */
 
530
#endif
 
531
);
 
532
 
 
533
extern int sunListInstalledColormaps(
 
534
#if NeedFunctionPrototypes
 
535
    ScreenPtr /* pScreen */,
 
536
    Colormap* /* pCmapList */
 
537
#endif
 
538
);
 
539
 
 
540
#endif