Convert uses of XKeycodeToKeysym (deprecated) to XkbKeycodeToKeysym
[oweals/cde.git] / cde / programs / dtcm / server / rtable3.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: rtable3.c /main/4 1995/11/09 12:51:59 rswiston $ */
24 /*
25  *  (c) Copyright 1993, 1994 Hewlett-Packard Company
26  *  (c) Copyright 1993, 1994 International Business Machines Corp.
27  *  (c) Copyright 1993, 1994 Novell, Inc.
28  *  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
29  */
30
31 /*
32   veneer layered on top of the real data structures for abstraction.
33         implements Version 3 in terms of Version 4 types        
34  */
35
36
37
38 #include <EUSCompat.h>
39 #include <stdio.h>
40 #include "rtable4.h"
41 #include "rtable3.h"
42 #include <sys/param.h>
43 #include <sys/time.h>
44 #include <rpc/rpc.h>
45 #include "rpcextras.h"
46 #include "convert3-4.h"
47 #include "convert4-3.h"
48 #include "rtable3_tbl.i"
49
50
51 /*************** V3 PROTOCOL IMPLEMENTATION PROCS *****************/
52 extern void *
53 _DtCm_rtable_ping_3_svc(void *args, struct svc_req *svcrq)
54 {
55         return(NULL); /* for RPC reply */
56 }
57
58 /*      PROC #1         */
59 extern Table_Res_3 *
60 _DtCm_rtable_lookup_3_svc (Table_Args_3 *args, struct svc_req *svcrq)
61 {
62         static Table_Res_3 *res = NULL;
63         Table_Args_4 *newargs;
64         Table_Res_4 *newres;
65
66         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
67
68         newargs = _DtCm_tableargs3_to_tableargs4(args);
69         if(newargs) {
70                 newres = _DtCm_rtable_lookup_4_svc(newargs, svcrq);
71                 res = _DtCm_tableres4_to_tableres3(newres);
72
73                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
74         }
75
76         return(res);
77 }
78
79 /*      PROC #2         */
80 extern Table_Res_3 *
81 _DtCm_rtable_lookup_next_larger_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
82 {
83         static Table_Res_3 *res = NULL;
84         Table_Args_4 *newargs;   
85         Table_Res_4 *newres; 
86  
87         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
88  
89         newargs = _DtCm_tableargs3_to_tableargs4(args);
90         if(newargs) {
91                 newres = _DtCm_rtable_lookup_next_larger_4_svc(newargs, svcrq);
92                 res = _DtCm_tableres4_to_tableres3(newres);
93  
94                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
95         }
96  
97         return(res);
98 }
99
100 /*      PROC #3         */
101 extern Table_Res_3 *
102 _DtCm_rtable_lookup_next_smaller_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
103 {
104         static Table_Res_3 *res = NULL; 
105         Table_Args_4 *newargs;    
106         Table_Res_4 *newres; 
107   
108         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
109
110         newargs = _DtCm_tableargs3_to_tableargs4(args);
111         if(newargs) {
112                 newres = _DtCm_rtable_lookup_next_smaller_4_svc(newargs, svcrq);
113                 res = _DtCm_tableres4_to_tableres3(newres);
114
115                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
116         }
117
118         return(res);
119 }
120
121 /*      PROC #4         */
122 extern Table_Res_3 *
123 _DtCm_rtable_lookup_range_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
124 {
125         static Table_Res_3 *res = NULL;  
126         Table_Args_4 *newargs;     
127         Table_Res_4 *newres; 
128    
129         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
130
131         newargs = _DtCm_tableargs3_to_tableargs4(args); 
132         if(newargs) {
133                 newres = _DtCm_rtable_lookup_range_4_svc(newargs, svcrq);
134                 res = _DtCm_tableres4_to_tableres3(newres);
135
136                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
137         }
138
139         return(res);
140 }
141
142 /*      PROC #5         */
143 extern Table_Res_3 *
144 _DtCm_rtable_abbreviated_lookup_range_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
145 {
146         static Table_Res_3 *res = NULL;   
147         Table_Args_4 *newargs;      
148         Table_Res_4 *newres; 
149
150         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
151
152         newargs = _DtCm_tableargs3_to_tableargs4(args);  
153         if(newargs) {
154                 newres = _DtCm_rtable_abbreviated_lookup_range_4_svc(newargs, svcrq);
155                 res = _DtCm_tableres4_to_tableres3(newres);
156
157                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
158         }
159
160         return(res);
161 }
162
163 /*      PROC #6         */
164 extern Table_Res_3 *
165 _DtCm_rtable_insert_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
166 {
167         static Table_Res_3 *res = NULL;
168         Table_Args_4 *newargs;
169         Table_Res_4 *newres;
170
171         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
172
173         newargs = _DtCm_tableargs3_to_tableargs4(args);
174         if(newargs) {
175                 newres = _DtCm_rtable_insert_4_svc(newargs, svcrq);
176                 res = _DtCm_tableres4_to_tableres3(newres);
177
178                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
179         }
180
181         return(res);
182 }
183
184 /*      PROC #7 */
185 extern Table_Res_3 *
186 _DtCm_rtable_delete_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
187 {
188         static Table_Res_3 *res = NULL; 
189         Table_Args_4 *newargs;
190         Table_Res_4 *newres; 
191
192         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
193
194         newargs = _DtCm_tabledelargs3_to_tabledelargs4(args, do_all_4);
195         if(newargs) {
196                 newres = _DtCm_rtable_delete_4_svc(newargs, svcrq);
197                 res = _DtCm_tableres4_to_tableres3(newres);
198
199                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
200         }
201
202         return(res); 
203 }
204
205 /*      PROC #8         */
206 extern Table_Res_3 *
207 _DtCm_rtable_delete_instance_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
208 {
209         static Table_Res_3 *res = NULL; 
210         Table_Args_4 *newargs;  
211         Table_Res_4 *newres;  
212
213         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
214
215         newargs = _DtCm_tabledelargs3_to_tabledelargs4(args, do_one_4);
216         if(newargs) {
217                 newres = _DtCm_rtable_delete_4_svc(newargs, svcrq);
218                 res = _DtCm_tableres4_to_tableres3(newres);
219
220                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
221         }
222
223         return(res);
224 }
225
226 /*      PROC #9 */
227 extern Table_Res_3 *
228 _DtCm_rtable_change_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
229 {
230         static Table_Res_3 *res = NULL;
231         Table_Args_4 *newargs; 
232         Table_Res_4 *newres;  
233
234         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL; 
235
236         newargs = _DtCm_tableargs3_to_tableargs4(args);
237         if(newargs) {
238                 newres = _DtCm_rtable_change_4_svc(newargs, svcrq);
239                 res = _DtCm_tableres4_to_tableres3(newres);
240
241                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
242         }
243
244         return(res); 
245 }
246
247
248 /*      PROC #10        */
249 extern Table_Res_3 *
250 _DtCm_rtable_change_instance_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
251 {
252         static Table_Res_3 *res = NULL; 
253         Table_Args_4 *newargs;   
254         Table_Res_4 *newres;  
255
256         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
257
258         newargs = _DtCm_tableargs3_to_tableargs4(args);
259         if(newargs) {
260                 newargs->args.Args_4_u.apptid.option = do_one_4;
261                 newres = _DtCm_rtable_change_4_svc(newargs, svcrq);
262                 res = _DtCm_tableres4_to_tableres3(newres);
263
264                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
265         }
266
267         return(res);
268 }
269
270 /*      PROC #11        */
271 extern Table_Res_3 *
272 _DtCm_rtable_lookup_next_reminder_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
273 {
274         static Table_Res_3 *res = NULL; 
275         Table_Args_4 *newargs;    
276         Table_Res_4 *newres;   
277
278         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
279
280         newargs = _DtCm_tableargs3_to_tableargs4(args);
281         if(newargs) {
282                 newres = _DtCm_rtable_lookup_next_reminder_4_svc(newargs, svcrq);
283                 res = _DtCm_tableres4_to_tableres3(newres);
284
285                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
286         }
287
288         return(res); 
289 }
290
291 /*      PROC #12        */
292 extern Table_Status_3 *
293 _DtCm_rtable_check_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
294 {
295         static Table_Status_3 res; 
296         Table_Args_4 *newargs;     
297         Table_Status_4 *newres;    
298
299         res = 0;
300
301         newargs = _DtCm_tableargs3_to_tableargs4(args);    
302         if(newargs) {
303                 newres = _DtCm_rtable_check_4_svc(newargs, svcrq);
304                 res = _DtCm_tablestat4_to_tablestat3(*newres);
305
306                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
307         }
308
309         return(&res); 
310 }
311
312 /*      PROC #13        */
313 extern Table_Status_3 *
314 _DtCm_rtable_flush_table_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
315 {
316         static Table_Status_3 res;  
317         Table_Args_4 *newargs;     
318         Table_Status_4 *newres;     
319
320         res = 0;
321
322         newargs = _DtCm_tableargs3_to_tableargs4(args);     
323         newres = _DtCm_rtable_flush_table_4_svc(newargs, svcrq);     
324         res = _DtCm_tablestat4_to_tablestat3(*newres);    
325
326         if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);      
327
328         return(&res);
329 }
330
331 /*      PROC #14        */
332 extern int *
333 _DtCm_rtable_size_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
334 {
335         static int size;   
336         Table_Args_4 *newargs;      
337
338         size = 0;
339
340         newargs = _DtCm_tableargs3_to_tableargs4(args);
341         if(newargs) {
342                 size = (*(_DtCm_rtable_size_4_svc(newargs, svcrq)));
343
344                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
345         }
346
347         return(&size);
348 }
349
350 /*      PROC #15        */
351 Registration_Status_3 *
352 _DtCm_register_callback_3_svc(Registration_3 *r, struct svc_req *svcrq)
353 {
354         static Registration_Status_3 stat;    
355         Registration_4 *newreg;       
356         Registration_Status_4 *newstat;
357
358         stat = 0;
359
360         newreg = _DtCm_reg3_to_reg4(r);
361         if(newreg) {
362                 newstat = _DtCm_register_callback_4_svc(newreg, svcrq);
363                 stat = _DtCm_regstat4_to_regstat3(*newstat);
364
365                 xdr_free((xdrproc_t)_DtCm_xdr_Registration_4, (char*)newreg);
366         }
367         return(&stat);
368 }
369
370 /*      PROC #16        */
371 Registration_Status_3 *
372 _DtCm_deregister_callback_3_svc(Registration_3 *r, struct svc_req *svcrq)
373 {
374         static Registration_Status_3 stat;     
375         Registration_4 *newreg;          
376         Registration_Status_4 *newstat; 
377
378         stat = 0;
379
380         newreg = _DtCm_reg3_to_reg4(r);
381         if(newreg) {
382                 newstat = _DtCm_deregister_callback_4_svc(newreg, svcrq);
383                 stat = _DtCm_regstat4_to_regstat3(*newstat);
384
385                 xdr_free((xdrproc_t)_DtCm_xdr_Registration_4, (char*)newreg);
386         }
387         return(&stat);
388 }
389
390 /*      PROC #17        */
391 extern Access_Status_3 *
392 _DtCm_rtable_set_access_3_svc(Access_Args_3 *args, struct svc_req *svcrq)
393 {
394         static Access_Status_3 stat;
395         Access_Args_4 *newargs;
396         Access_Status_4 *newstat;
397
398         stat = 0;
399
400         newargs = _DtCm_accargs3_to_accargs4(args);
401         if(newargs) {
402                 newstat = _DtCm_rtable_set_access_4_svc(newargs, svcrq);
403                 stat = _DtCm_accstat4_to_accstat3(*newstat);
404
405                 xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_4, (char*)newargs);
406         }
407         return(&stat);
408 }
409
410 /*      PROC #18        */
411 extern Access_Args_3 *
412 _DtCm_rtable_get_access_3_svc(Access_Args_3 *args, struct svc_req *svcrq)
413 {
414         static Access_Args_3 *res = NULL;
415         Access_Args_4 *newargs;
416         Access_Args_4 *newres;
417
418         if (res!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_3, (char*)res); res = NULL;
419
420         newargs = _DtCm_accargs3_to_accargs4(args);
421         if(newargs) {
422                 newres = _DtCm_rtable_get_access_4_svc(newargs, svcrq);
423                 res = _DtCm_accargs4_to_accargs3(newres);
424
425                 xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_4, (char*)newargs);
426         }
427         return(res); 
428 }
429
430 /*      PROC #19        */
431 extern Table_Res_3 *
432 _DtCm_rtable_abbreviated_lookup_key_range_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
433 {
434         static Table_Res_3 *res = NULL;
435         Table_Args_4 *newargs;   
436         Table_Res_4 *newres;  
437
438         if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
439
440         newargs = _DtCm_tableargs3_to_tableargs4(args);
441         if(newargs) {
442                 newres = _DtCm_rtable_abbreviated_lookup_key_range_4_svc(newargs, svcrq);
443                 res = _DtCm_tableres4_to_tableres3(newres);
444
445                 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
446         }
447         return(res); 
448 }
449
450 /*      PROC #20        */
451 extern long *
452 _DtCm_rtable_gmtoff_3_svc(void *args, struct svc_req *svcrq)
453 {
454         static long gmtoff;
455
456         gmtoff = (*(_DtCm_rtable_gmtoff_4_svc(NULL, svcrq)));
457
458         return(&gmtoff);
459 }
460
461 void initrtable3(program_handle ph)
462 {
463         ph->program_num = TABLEPROG;
464         ph->prog[TABLEVERS_3].vers = &tableprog_3_table[0];
465         ph->prog[TABLEVERS_3].nproc = sizeof(tableprog_3_table)/sizeof(tableprog_3_table[0]);
466 }
467