1 /*
2  * Copyright 1993 Network Computing Devices, Inc.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation, and that the name Network Computing Devices, Inc. not be
9  * used in advertising or publicity pertaining to distribution of this
10  * software without specific, written prior permission.
11  *
12  * THIS SOFTWARE IS PROVIDED 'AS-IS'.  NETWORK COMPUTING DEVICES, INC.,
13  * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
14  * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
15  * PARTICULAR PURPOSE, OR NONINFRINGEMENT.  IN NO EVENT SHALL NETWORK
16  * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
17  * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
18  * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
19  * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
20  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  *
22  * $NCDId: @(#)Aproto.h,v 1.34 1995/12/06 01:30:44 greg Exp $
23  */
24 
25 /* Portions derived from */
26 /*
27  * $XConsortium: Xproto.h,v 1.86 92/10/18 16:33:19 rws Exp $
28  */
29 
30 /* Definitions for the X window system used by server and c bindings */
31 
32 /*
33  * This packet-construction scheme makes the following assumptions:
34  *
35  * 1. The compiler is able to generate code which addresses one- and two-byte
36  * quantities. In the worst case, this would be done with bit-fields.  If
37  * bit-fields are used it may be necessary to reorder the request fields in
38  * this file, depending on the order in which the machine assigns bit fields
39  * to machine words.  There may also be a problem with sign extension, as K+R
40  * specify that bitfields are always unsigned.
41  *
42  * 2. 2- and 4-byte fields in packet structures must be ordered by hand such
43  * that they are naturally-aligned, so that no compiler will ever insert
44  * padding bytes.
45  *
46  * 3. All packets are hand-padded to a multiple of 4 bytes, for the same reason.
47  */
48 
49 #ifndef NCD_AUDIO_PROTO_H
50 #define NCD_AUDIO_PROTO_H
51 
52 /***********************************************************
53 Portions of the comments are
54 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
55 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
56 
57                         All Rights Reserved
58 
59 Permission to use, copy, modify, and distribute this software and its
60 documentation for any purpose and without fee is hereby granted,
61 provided that the above copyright notice appear in all copies and that
62 both that copyright notice and this permission notice appear in
63 supporting documentation, and that the names of Digital or MIT not be
64 used in advertising or publicity pertaining to distribution of the
65 software without specific, written prior permission.
66 
67 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
68 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
69 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
70 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
71 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
72 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
73 SOFTWARE.
74 
75 ******************************************************************/
76 
77 #include <audio/Amd.h>
78 
79 /*
80  * Define constants for the sizes of the network packets.  The sz_ prefix is
81  * used instead of something more descriptive so that the symbols are no more
82  * than 32 characters in length (which causes problems for some compilers).
83  */
84 
85 
86 /*
87  * For the purpose of the structure definitions in this file, we must
88  * redefine the following types in terms of Xmd.h's types, which may include
89  * bit fields.  All of these are #undef'd at the end of this file, restoring
90  * the definitions in X.h.
91  */
92 
93 #define AuDeviceID			CARD32
94 #define AuBucketID			CARD32
95 #define AuFlowID			CARD32
96 #define AuRadioID			CARD32
97 #define AuTime				CARD32
98 
99 
100 #define AU_DEFAULT_TCP_PORT		8000
101 #define AU_DEFAULT_DECNET_TASK		"AUDIO$"
102 
103 #if defined(linux)
104 # define AU_DEFAULT_UNIX_PATH		"/var/run/nasd/audio"
105 #else
106 # define AU_DEFAULT_UNIX_PATH		"/tmp/.sockets/audio"
107 #endif
108 
109 #define auFalse				0
110 #define auTrue				1
111 
112 
113 /*
114  * Request codes
115  */
116 #define Au_ListDevices			1
117 #define Au_GetDeviceAttributes		2
118 #define Au_SetDeviceAttributes		3
119 
120 #define Au_CreateBucket			4
121 #define Au_DestroyBucket		5
122 #define Au_ListBuckets			6
123 #define Au_GetBucketAttributes		7
124 #define Au_SetBucketAttributes		8
125 
126 #define Au_CreateRadio			9
127 #define Au_DestroyRadio			10
128 #define Au_ListRadios			11
129 #define Au_GetRadioAttributes		12
130 #define Au_SetRadioAttributes		13
131 
132 #define Au_CreateFlow			14
133 #define Au_DestroyFlow			15
134 #define Au_GetFlowAttributes		16
135 #define Au_SetFlowAttributes		17
136 #define Au_GetElements			18
137 #define Au_SetElements			19
138 #define Au_GetElementStates		20
139 #define Au_SetElementStates		21
140 #define Au_GetElementParameters		22
141 #define Au_SetElementParameters		23
142 #define Au_WriteElement			24
143 #define Au_ReadElement			25
144 
145 #define Au_GrabComponent		26
146 #define Au_UngrabComponent		27
147 #define Au_SendEvent			28
148 
149 #define Au_GetAllowedUsers		29
150 #define Au_SetAllowedUsers		30
151 
152 #define Au_ListExtensions		31
153 #define Au_QueryExtension		32
154 #define Au_GetCloseDownMode		33
155 #define Au_SetCloseDownMode		34
156 #define Au_KillClient			35
157 #define Au_GetServerTime		36
158 #define Au_NoOperation			37
159 
160 /*
161  * Reply codes
162  */
163 #define Au_Error			0
164 #define Au_Reply			1
165 
166 
167 
168 
169 /*****************************************************************************
170  *				  DATA TYPES				     *
171  *****************************************************************************/
172 
173 
174 
175 #ifndef NO_AUDIO_REQUESTS
176 
177 /*****************************************************************************
178  *			       CONNECTION SETUP				     *
179  *****************************************************************************/
180 
181 typedef struct
182 {
183     CARD8           byteOrder;
184     BYTE            pad;
185     CARD16          majorVersion B16;
186     CARD16          minorVersion B16;
187     CARD16          nbytesAuthProto B16;	/* Authorization protocol */
188     CARD16          nbytesAuthString B16;	/* Authorization string */
189     CARD16          pad1 B16;
190 }               auConnClientPrefix;
191 #define sz_auConnClientPrefix		12
192 
193 typedef struct
194 {
195     AUBOOL          success;
196     BYTE            lengthReason;		/* bytes in string following
197 						 * if failure */
198     CARD16          majorVersion B16;
199     CARD16          minorVersion B16;
200     CARD16          length B16;			/* 1/4 additional bytes in
201 						 * setup info */
202 }               auConnSetupPrefix;
203 #define sz_auConnSetupPrefix		8
204 
205 
206 typedef struct
207 {
208     CARD32          release B32;
209     CARD32          ridBase B32;
210     CARD32          ridMask B32;
211     CARD16          minSampleRate B16;
212     CARD16          maxSampleRate B16;
213     CARD16          nbytesVendor B16;		/* bytes in vendor string */
214     CARD16          maxRequestSize B16;
215     CARD8           maxTracks;
216     CARD8           numFormats;
217     CARD8           numElementTypes;
218     CARD8           numWaveForms;
219     CARD8	    numActions;
220     CARD8           numDevices;
221     CARD8           numBuckets;
222     CARD8           numRadios;
223     /* vendor string */
224     /* formats */
225     /* element types */
226     /* wave forms */
227     /* actions */
228     /* device attributes */
229     /* bucket attributes */
230     /* radio attributes */
231 }               auConnSetup;
232 #define sz_auConnSetup			28
233 
234 typedef struct
235 {
236     CARD8           type;			/* AuStringLatin1, ... */
237     BYTE            pad;
238     BYTE            pad1;
239     BYTE            pad2;
240     CARD32          len B32;			/* length in bytes */
241     /* string */
242 }               auString;
243 #define sz_auString 			8
244 
245 /*
246  * Attributes used for Devices, Buckets, and Radios
247  */
248 typedef struct
249 {
250     CARD32          value_mask B32;		/* what is present */
251     CARD32          changable_mask B32;		/* what can be changed */
252     AuID            id B32;			/* used to reference in flows */
253     CARD8           kind;			/* what type of object is it */
254     CARD8           use;			/* importable, exportable,
255 						 * etc. */
256     CARD8           format;			/* current value */
257     CARD8           num_tracks;			/* 1 for mono, 2 for stereo,
258 						 * etc. */
259     CARD32          access B32;			/* who can access */
260     auString        description;		/* description of device */
261 }               auCommonPart;
262 #define sz_auCommonPart			(20 + sz_auString)
263 
264 
265 /*
266  * Device attributes - these are physical devices attached to the server.
267  */
268 typedef struct
269 {
270     CARD32          location B32;		/* mask of bits */
271     CARD32          gain B32;			/* 16.16% */
272     CARD16          min_sample_rate B16;
273     CARD16          max_sample_rate B16;
274     CARD8           line_mode;			/* high vs. low amp circuit */
275     CARD8           num_children;		/* number of subdevices, if
276 						 * any */
277     CARD16          pad B16;
278     /* children */
279 }               auDevicePart;
280 #define sz_auDevicePart			16
281 
282 typedef struct
283 {
284     auCommonPart    common;
285     auDevicePart    device;
286 }               auDeviceAttributes;
287 #define sz_auDeviceAttributes		(sz_auCommonPart + sz_auDevicePart)
288 
289 /*
290  * Bucket attributes - these are server storage for sound data.
291  */
292 typedef struct
293 {
294     CARD16          sample_rate B16;		/* current value */
295     CARD16          pad B16;
296     CARD32          num_samples B32;		/* max number in this device */
297 }               auBucketPart;
298 #define sz_auBucketPart			8
299 
300 typedef struct
301 {
302     auCommonPart    common;
303     auBucketPart    bucket;
304 }               auBucketAttributes;
305 #define sz_auBucketAttributes		(sz_auCommonPart + sz_auBucketPart)
306 
307 #ifdef notdef
308 /*
309  * Radio attributes - these are special devices for LAN broadcast audio data
310  */
311 typedef struct
312 {
313     CARD32          station B32;		/* which one you are
314 						 * listening to */
315 }               auRadioPart;
316 #define sz_auRadioPart			4
317 
318 typedef struct
319 {
320     auCommonPart    common;
321     auRadioPart     radio;
322 }               auRadioAttributes;
323 #define sz_auRadioAttributes		(sz_auCommonPart + sz_auRadioPart)
324 
325 #endif						/* notdef */
326 
327 
328 /*****************************************************************************
329  *			     REQUESTS and REPLIES			     *
330  *****************************************************************************/
331 
332 typedef struct
333 {
334     CARD8           reqType;
335     CARD8           data;			/* meaning depends upon req
336 						 * type */
337     CARD16          length B16;			/* 4-byte quants, including
338 						 * header */
339 }               auReq;
340 #define sz_auReq			4
341 
342 /*
343  * ResourceReq is used for any request which has a resource ID (or Atom or
344  * Time) as its one and only argument.
345  */
346 typedef struct
347 {
348     CARD8           reqType;
349     BYTE            pad;
350     CARD16          length B16;
351     AuID            id B32;			/* a Flow, Buffer, or Device */
352 }               auResourceReq;
353 #define sz_auResourceReq		8
354 
355 
356 /*
357  * GenericReply is the common format of all replies.  The "data" items are
358  * specific to each individual reply type.
359  */
360 typedef struct
361 {
362     BYTE            type;			/* Au_Reply */
363     BYTE            data1;			/* depends on reply type */
364     CARD16          sequenceNumber B16;		/* of last request received */
365     CARD32          length B32;			/* 4 byte quant beyond
366 						 * GenericReply */
367     CARD32          data00 B32;
368     CARD32          data01 B32;
369     CARD32          data02 B32;
370     CARD32          data03 B32;
371     CARD32          data04 B32;
372     CARD32          data05 B32;
373 }               auGenericReply;
374 
375 
376 /*
377  * see down below EVENTS for the auReply object.
378  */
379 
380 
381 /* CreateFlow uses a ResourceReq */
382 /* DestroyFlow uses a ResourceReq */
383 /* GetDeviceAttributes uses a ResourceReq */
384 
385 typedef struct
386 {
387     BYTE            type;			/* Au_Reply */
388     CARD8           pad;
389     CARD16          sequenceNumber B16;
390     CARD32          length B32;
391     CARD32          pad1 B32;
392     CARD32          pad2 B32;
393     CARD32          pad3 B32;
394     CARD32          pad4 B32;
395     CARD32          pad5 B32;
396     CARD32          pad6 B32;
397     /* DEVICEATTRIBUTES */
398 }               auGetDeviceAttributesReply;
399 #define sz_auGetDeviceAttributesReply	32
400 
401 /* SetDeviceAttributes uses a ResourceReq */
402 
403 /* CreateBucket uses a ResourceReq */
404 /* DestroyBucket uses a ResourceReq */
405 /* GetBucketAttributes uses a ResourceReq */
406 
407 typedef struct
408 {
409     BYTE            type;			/* Au_Reply */
410     CARD8           pad;
411     CARD16          sequenceNumber B16;
412     CARD32          length B32;
413     CARD32          pad1 B32;
414     CARD32          pad2 B32;
415     CARD32          pad3 B32;
416     CARD32          pad4 B32;
417     CARD32          pad5 B32;
418     CARD32          pad6 B32;
419     /* BUCKETATTRIBUTES */
420 }               auGetBucketAttributesReply;
421 #define sz_auGetBucketAttributesReply	32
422 
423 /* ListBuckets uses a Req */
424 
425 typedef struct
426 {
427     BYTE            type;			/* Au_Reply */
428     CARD8           pad;
429     CARD16          sequenceNumber B16;
430     CARD32          length B32;
431     CARD32          num_buckets B32;
432     CARD32          pad1 B32;
433     CARD32          pad2 B32;
434     CARD32          pad3 B32;
435     CARD32          pad4 B32;
436     CARD32          pad5 B32;
437     /* BUCKETATTRIBUTES */
438 }               auListBucketsReply;
439 #define sz_auListBucketsReply	32
440 
441 /* ListDevices uses a Req */
442 
443 typedef struct
444 {
445     BYTE            type;			/* Au_Reply */
446     CARD8           pad;
447     CARD16          sequenceNumber B16;
448     CARD32          length B32;
449     CARD32          num_devices B32;
450     CARD32          pad1 B32;
451     CARD32          pad2 B32;
452     CARD32          pad3 B32;
453     CARD32          pad4 B32;
454     CARD32          pad5 B32;
455     /* DEVICEATTRIBUTES */
456 }               auListDevicesReply;
457 #define sz_auListDevicesReply	32
458 
459 /* GetElements uses a ResourceReq */
460 
461 typedef struct
462 {
463     BYTE            type;			/* Au_Reply */
464     AUBOOL          clocked;
465     CARD16          sequenceNumber B16;
466     CARD32          length B32;
467     AuFlowID        flow B32;
468     CARD32          num_elements B32;
469     CARD32          pad B32;
470     CARD32          pad1 B32;
471     CARD32          pad2 B32;
472     CARD32          pad3 B32;
473     /* LISTofELEMENTS */
474 }               auGetElementsReply;
475 #define sz_auGetElementsReply	32
476 
477 
478 /* ELEMENTS */
479 
480 /* ACTIONS */
481 typedef struct
482 {
483     AuFlowID        flow B32;			/* target flow to affect */
484     CARD8           element_num;		/* target element to affect */
485     CARD8           trigger_state;		/* state to trigger action */
486     CARD8           trigger_prev_state;		/* previous state to trigger
487 						 * action */
488     CARD8           trigger_reason;		/* reason to trigger action */
489     CARD8           action;			/* what to do */
490     CARD8           new_state;			/* new state for target */
491     CARD16          pad B16;
492 }               auElementAction;
493 #define sz_auElementAction 		12
494 
495 typedef struct
496 {
497     CARD32          num_actions B32;
498     /* LISTofACTIONS */
499 }               auElementActionList;
500 #define sz_auElementActionList		4
501 
502 /* IMPORTS */
503 
504 typedef struct
505 {
506     CARD16          type B16;			/* AuElementTypeImportClient */
507     CARD16          sample_rate B16;
508     CARD8           format;
509     CARD8           num_tracks;
510     AUBOOL          discard;
511     CARD8           pad;
512     CARD32          max_samples B32;
513     CARD32          low_water_mark B32;
514     auElementActionList actions;
515 }               auElementImportClient;
516 #define sz_auElementImportClient	(16 + sz_auElementActionList)
517 
518 typedef struct
519 {
520     CARD16          type B16;			/* AuElementTypeImportDevice */
521     CARD16          sample_rate B16;
522     CARD32          num_samples B32;
523     AuDeviceID      device B32;
524     auElementActionList actions;
525 }               auElementImportDevice;
526 #define sz_auElementImportDevice	(12 + sz_auElementActionList)
527 
528 typedef struct
529 {
530     CARD16          type B16;			/* AuElementTypeImportBucket */
531     CARD16          sample_rate B16;
532     CARD32          num_samples B32;
533     AuBucketID      bucket B32;
534     CARD32          offset B32;
535     auElementActionList actions;
536 }               auElementImportBucket;
537 #define sz_auElementImportBucket	(16 + sz_auElementActionList)
538 
539 typedef struct
540 {
541     CARD16          type B16;			/* AuElementTypeImportWaveForm */
542     CARD16          sample_rate B16;
543     CARD32          num_samples B32;
544     CARD8           wave_form;
545     CARD8           pad;
546     CARD8           pad1;
547     CARD8           pad2;
548     CARD32          frequency B32;
549     auElementActionList actions;
550 }               auElementImportWaveForm;
551 #define sz_auElementImportWaveForm		(16 + sz_auElementActionList)
552 
553 /* OPS */
554 
555 typedef struct
556 {
557     CARD8           element_num;
558     CARD8           track;
559     CARD16          pad B16;
560 }               auInputTrack;
561 #define sz_auInputTrack			4
562 
563 typedef struct
564 {
565     CARD16          type B16;			/* AuElementTypeBundle */
566     CARD16          num_inputs B16;
567     /* LISTofTRACKS */
568 }               auElementBundle;
569 #define sz_auElementBundle		4
570 
571 typedef struct
572 {
573     CARD16          type B16;			/* AuElementTypeMultiplyConsta
574 						 * nt */
575     CARD16          input B16;
576     CARD32          constant B32;		/* 16.16 */
577 }               auElementMultiplyConstant;
578 #define sz_auElementMultiplyConstant	8
579 
580 typedef struct
581 {
582     CARD16          type B16;			/* AuElementTypeAddConstant */
583     CARD16          input B16;
584     CARD32          constant B32;		/* 16.16 */
585 }               auElementAddConstant;
586 #define sz_auElementAddConstant		8
587 
588 typedef struct
589 {
590     CARD16          type B16;			/* AuElementTypeSum */
591     CARD16          num_inputs B16;
592     /* LISTofCARD16 */
593 }               auElementSum;
594 #define sz_auElementSum			4
595 
596 /* EXPORTS */
597 
598 typedef struct
599 {
600     CARD16          type B16;			/* AuElementTypeExportClient */
601     CARD16          sample_rate B16;
602     CARD16          input B16;
603     CARD16          pad B16;
604     CARD8           format;
605     CARD8           num_tracks;
606     AUBOOL          discard;
607     CARD8           pad1;
608     CARD32          max_samples B32;
609     CARD32          high_water_mark B32;
610     auElementActionList actions;
611 }               auElementExportClient;
612 #define sz_auElementExportClient	(20 + sz_auElementActionList)
613 
614 typedef struct
615 {
616     CARD16          type B16;			/* AuElementTypeExportDevice */
617     CARD16          sample_rate B16;
618     CARD16          input B16;
619     CARD16          pad B16;
620     CARD32          num_samples B32;
621     AuDeviceID      device B32;
622     auElementActionList actions;
623 }               auElementExportDevice;
624 #define sz_auElementExportDevice	(16 + sz_auElementActionList)
625 
626 typedef struct
627 {
628     CARD16          type B16;			/* AuElementTypeExportBucket */
629     CARD16          input B16;
630     CARD32          num_samples B32;
631     AuBucketID      bucket B32;
632     CARD32          offset B32;
633     auElementActionList actions;
634 }               auElementExportBucket;
635 #define sz_auElementExportBucket	(16 + sz_auElementActionList)
636 
637 typedef struct
638 {
639     CARD16          type B16;			/* AuElementTypeExportMonitor */
640     CARD16          event_rate B16;
641     CARD16          input B16;
642     CARD16          pad B16;
643     CARD8           format;
644     CARD8           num_tracks;
645     CARD16          pad1 B16;
646 }               auElementExportMonitor;
647 #define sz_auElementExportMonitor	12
648 
649 #define sz_auElementMAX			sz_auElementExportClient
650 
651 typedef union					/* generic element */
652 {
653     CARD16          type B16;
654     auElementImportClient importclient;
655     auElementImportDevice importdevice;
656     auElementImportBucket importbucket;
657     auElementImportWaveForm importwaveform;
658 #ifdef NOTYET
659     auElementImportRadio importradio;
660 #endif						/* NOTYET */
661     auElementBundle bundle;
662     auElementMultiplyConstant multiplyconstant;
663     auElementAddConstant addconstant;
664     auElementSum    sum;
665     auElementExportClient exportclient;
666     auElementExportDevice exportdevice;
667     auElementExportBucket exportbucket;
668 #ifdef NOTYET
669     auElementExportRadio exportradio;
670 #endif						/* NOTYET */
671     auElementExportMonitor exportmonitor;
672 }               auElement;
673 #define sz_auElement			sz_auElementMAX
674 
675 typedef struct
676 {
677     CARD8           reqType;
678     AUBOOL          clocked;
679     CARD16          length B16;
680     AuFlowID        flow B32;
681     CARD32          numElements B32;
682     /* LISTofELEMENTS */
683 }               auSetElementsReq;
684 #define sz_auSetElementsReq		12
685 
686 /* KillClient uses a ResourceReq */
687 
688 typedef struct
689 {
690     AuFlowID        flow B32;
691     CARD8           element_num;
692     CARD8           state;
693     CARD16          pad B16;
694 }               auElementState;
695 #define sz_auElementState		8
696 
697 typedef struct
698 {
699     CARD8           reqType;
700     CARD8           pad;
701     CARD16          length B16;
702     CARD32          numStates B32;
703     /* LISTofELEMENTSTATES */
704 }               auSetElementStatesReq;
705 #define sz_auSetElementStatesReq 	8
706 
707 typedef struct
708 {
709     CARD8           reqType;
710     CARD8           pad;
711     CARD16          length B16;
712     CARD32          numStates B32;
713     /* LISTofELEMENTSTATES */
714 }               auGetElementStatesReq;
715 #define sz_auGetElementStatesReq 	8
716 
717 typedef struct
718 {
719     BYTE            type;			/* Au_Reply */
720     CARD8           pad;
721     CARD16          sequenceNumber B16;
722     CARD32          length B32;
723     CARD32          numStates B32;
724     CARD32          pad1 B32;
725     CARD32          pad2 B32;
726     CARD32          pad3 B32;
727     CARD32          pad4 B32;
728     CARD32          pad5 B32;
729     /* LISTofELEMENTSTATES */
730 }               auGetElementStatesReply;
731 #define sz_auGetElementStatesReply		32
732 
733 typedef struct
734 {
735     CARD8           reqType;
736     CARD8           element_num;
737     CARD16          length B16;
738     AuFlowID        flow B32;
739     CARD32          num_bytes B32;
740     CARD8           state;
741     CARD8           pad;
742     CARD8           pad1;
743     CARD8           pad2;
744     /* LISTofBYTE */
745 }               auWriteElementReq;
746 #define sz_auWriteElementReq		16
747 
748 typedef struct
749 {
750     CARD8           reqType;
751     CARD8           element_num;
752     CARD16          length B16;
753     AuFlowID        flow B32;
754     CARD32          num_bytes B32;
755 }               auReadElementReq;
756 #define sz_auReadElementReq		12
757 
758 typedef struct
759 {
760     BYTE            type;			/* Au_Reply */
761     CARD8           pad;
762     CARD16          sequenceNumber B16;
763     CARD32          length B32;
764     CARD32          num_bytes B32;
765     CARD32          pad1 B32;
766     CARD32          pad2 B32;
767     CARD32          pad3 B32;
768     CARD32          pad4 B32;
769     CARD32          pad5 B32;
770     /* LISTofBYTE */
771 }               auReadElementReply;
772 #define sz_auReadElementReply		32
773 
774 typedef struct
775 {
776     AuFlowID        flow B32;
777     CARD8           element_num;
778     CARD8           num_parameters;
779     CARD16          pad B16;
780     /* LISTofCARD32 */
781 }               auElementParameters;
782 #define sz_auElementParameters 		8
783 
784 typedef struct
785 {
786     CARD8           reqType;
787     CARD8           pad;
788     CARD16          length B16;
789     CARD32          numParameters B32;
790     /* LISTofPARAMETERS */
791 }               auSetElementParametersReq;
792 #define sz_auSetElementParametersReq	8
793 
794 typedef struct
795 {
796     CARD8           reqType;
797     BYTE            mode;
798     CARD16          length B16;
799 }               auSetCloseDownModeReq;
800 #define sz_auSetCloseDownModeReq 	4
801 
802 
803 /* GetCloseDownMode just uses an empty request */
804 
805 typedef struct
806 {
807     BYTE            type;			/* Au_Reply */
808     CARD8           closeDownMode;
809     CARD16          sequenceNumber B16;
810     CARD32          length B32;			/* 0 */
811     CARD32          pad0 B32;
812     CARD32          pad1 B32;
813     CARD32          pad2 B32;
814     CARD32          pad3 B32;
815     CARD32          pad4 B32;
816     CARD32          pad5 B32;
817 }               auGetCloseDownModeReply;
818 #define sz_auGetCloseDownModeReply	32
819 
820 /* GetServerTime just uses an empty request */
821 
822 typedef struct
823 {
824     BYTE            type;			/* Au_Reply */
825     CARD8           pad;
826     CARD16          sequenceNumber B16;
827     CARD32          length B32;			/* 0 */
828     AuTime          time B32;
829     CARD32          pad1 B32;
830     CARD32          pad2 B32;
831     CARD32          pad3 B32;
832     CARD32          pad4 B32;
833     CARD32          pad5 B32;
834 }               auGetServerTimeReply;
835 #define sz_auGetServerTime Reply	32
836 
837 #endif						/* NO_AUDIO_REQUESTS */
838 
839 
840 #ifndef NO_AUDIO_EVENTS
841 /*****************************************************************************
842  *				    EVENTS				     *
843  *****************************************************************************/
844 
845 /*
846  * auEvent - all event packets are 32 bytes long
847  */
848 typedef struct _auEvent
849 {
850     union
851     {
852 	struct
853 	{
854 	    BYTE            type;
855 	    BYTE            detail;
856 	    CARD16          sequenceNumber B16;
857 	    AuTime          time B32;
858 	}               u;
859 	struct
860 	{
861 	    CARD32          pad B32;		/* padding for common data */
862 	    CARD32          pad1 B32;
863 
864 	    AuFlowID        flow B32;
865 	    CARD16          element_num B16;
866 	    CARD16          kind B16;
867 	    CARD16          prev_state B16;
868 	    CARD16          cur_state B16;
869 	    CARD16          reason B16;
870 	    CARD16          pad2 B16;
871 	    CARD32          num_bytes B32;
872 	}               elementNotify;
873 	struct
874 	{
875 	    CARD32          pad B32;		/* padding for common data */
876 	    CARD32          pad1 B32;
877 
878 	    AuFlowID        flow B32;
879 	    CARD16          element_num B16;
880 	    CARD8           format;
881 	    CARD8           num_tracks;
882 	    CARD16          count B16;
883 	    CARD16          num_fields B16;
884 	    CARD32          data B32;
885 	    CARD32          data1 B32;
886 	    CARD32          data2 B32;
887 	}               monitorNotify;
888     }               u;
889 }               auEvent;
890 #define sz_auEvent			32
891 
892 /*
893  * auError - errors are just special types of event packets.
894  */
895 typedef struct _auError
896 {
897     BYTE            type;			/* Au_Error */
898     BYTE            errorCode;
899     CARD16          sequenceNumber B16;
900     AuTime          time B32;
901     CARD32          resourceID B32;
902     CARD16          minorCode B16;
903     CARD8           majorCode;
904     BYTE            pad;
905     CARD32          data0 B32;
906     CARD32          data1 B32;
907     CARD32          data2 B32;
908     CARD32          data3 B32;
909 }               auError;
910 #define sz_auError			32
911 
912 #endif						/* NO_AUDIO_EVENTS */
913 
914 
915 #ifndef NO_AUDIO_REPLIES
916 /*****************************************************************************
917  *				    CLEANUP				     *
918  *****************************************************************************/
919 
920 /*
921  * AuReply is the union of all the replies above whose "fixed part" fits in
922  * 32 bytes.  It does NOT include ...
923  */
924 typedef union
925 {
926     auGenericReply  generic;
927     auGetCloseDownModeReply getCloseDownMode;
928     auError         error;
929     auEvent         event;
930 }               auReply;
931 #define sz_auReply			32
932 
933 #endif						/* NO_AUDIO_REPLIES */
934 
935 /* restore these definitions back to the typedefs in X.h */
936 #undef AuDevice
937 #undef AuBuffer
938 #undef AuFlow
939 #undef AuTime
940 
941 #endif						/* NCD_AUDIO_PROTO_H */
942