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: @(#)SetElParms.c,v 1.1 1993/01/26 05:11:16 greg Exp $
23  */
24 
25 #include "Alibint.h"
26 
27 void
AuSetElementParameters(AuServer * aud,int num_changes,AuElementParameters * parms,AuStatus * ret_status)28 AuSetElementParameters(
29                        AuServer *aud,
30                        int num_changes,
31                        AuElementParameters *parms,
32                        AuStatus *ret_status
33                        )
34 {
35     auSetElementParametersReq *req;
36     int i, total_parameters = 0;
37     auElementParameters p;
38 
39     if (ret_status)
40 	*ret_status = AuSuccess;
41 
42 
43     for (i = 0; i < num_changes; i++)
44 	total_parameters += parms[i].num_parameters;
45 
46     _AuLockServer();
47     _AuGetReq(SetElementParameters, req, aud);
48 
49     req->numParameters = num_changes;
50     req->length += (num_changes * SIZEOF(auElementParameters) +
51 		    total_parameters * sizeof(CARD32)) >> 2;
52 
53     for (i = 0; i < num_changes; i++, parms++)
54     {
55 #undef xfer
56 #define xfer(x) p.x = parms->x
57 	xfer(flow);
58 	xfer(element_num);
59 	xfer(num_parameters);
60 
61 	_AuData32(aud, &p, SIZEOF(auElementParameters));
62 	_AuData32(aud, parms->parameters,
63 		  sizeof(CARD32) * parms->num_parameters);
64     }
65 
66     (void) _AuIfRoundTrip(aud, ret_status);
67     _AuUnlockServer();
68     _AuSyncHandle(aud);
69 }
70