2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: rtable2.c /main/4 1995/11/09 12:51:38 rswiston $ */
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.
32 veneer layered on top of the real data structures for abstraction.
33 implements Version 2 in terms of Version 4 types
38 #include <EUSCompat.h>
42 #include <sys/param.h>
45 #include "rpcextras.h"
46 #include "convert2-4.h"
47 #include "convert4-2.h"
48 #include "rtable2_tbl.i"
51 /*************** V2 PROTOCOL IMPLEMENTATION PROCS *****************/
53 _DtCm_rtable_ping_2_svc(args, svcrq)
55 struct svc_req *svcrq;
58 return((void *)&dummy); /* for RPC reply */
63 _DtCm_rtable_lookup_2_svc (args, svcrq)
65 struct svc_req *svcrq;
67 static Table_Res_2 *res = NULL;
68 Table_Args_4 *newargs;
71 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res);
73 newargs = _DtCm_tableargs2_to_tableargs4(args);
74 newres = _DtCm_rtable_lookup_4_svc(newargs, svcrq);
76 res = _DtCm_tableres4_to_tableres2(newres);
78 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
85 _DtCm_rtable_lookup_next_larger_2_svc(args, svcrq)
87 struct svc_req *svcrq;
89 static Table_Res_2 *res = NULL;
90 Table_Args_4 *newargs;
93 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res);
95 newargs = _DtCm_tableargs2_to_tableargs4(args);
96 newres = _DtCm_rtable_lookup_next_larger_4_svc(newargs, svcrq);
98 res = _DtCm_tableres4_to_tableres2(newres);
100 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
108 _DtCm_rtable_lookup_next_smaller_2_svc(args, svcrq)
110 struct svc_req *svcrq;
112 static Table_Res_2 *res = NULL;
113 Table_Args_4 *newargs;
116 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res);
118 newargs = _DtCm_tableargs2_to_tableargs4(args);
119 newres = _DtCm_rtable_lookup_next_smaller_4_svc(newargs, svcrq);
121 res = _DtCm_tableres4_to_tableres2(newres);
123 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
131 _DtCm_rtable_lookup_range_2_svc(args, svcrq)
133 struct svc_req *svcrq;
135 static Table_Res_2 *res = NULL;
136 Table_Args_4 *newargs;
139 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res);
141 newargs = _DtCm_tableargs2_to_tableargs4(args);
142 newres = _DtCm_rtable_lookup_range_4_svc(newargs, svcrq);
144 res = _DtCm_tableres4_to_tableres2(newres);
146 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
153 _DtCm_rtable_abbreviated_lookup_range_2_svc(args, svcrq)
155 struct svc_req *svcrq;
157 static Table_Res_2 *res = NULL;
158 Table_Args_4 *newargs;
161 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res);
163 newargs = _DtCm_tableargs2_to_tableargs4(args);
164 newres = _DtCm_rtable_abbreviated_lookup_range_4_svc(newargs, svcrq);
166 res = _DtCm_tableres4_to_tableres2(newres);
168 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
175 _DtCm_rtable_insert_2_svc(args, svcrq)
177 struct svc_req *svcrq;
179 static Table_Res_2 *res = NULL;
180 Table_Args_4 *newargs;
183 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res);
185 newargs = _DtCm_tableargs2_to_tableargs4(args);
186 newres = _DtCm_rtable_insert_4_svc(newargs, svcrq);
188 res = _DtCm_tableres4_to_tableres2(newres);
190 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
197 _DtCm_rtable_delete_2_svc(args, svcrq)
199 struct svc_req *svcrq;
201 static Table_Res_2 *res = NULL;
202 Table_Args_4 *newargs;
205 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res);
207 newargs = _DtCm_tabledelargs2_to_tabledelargs4(args, do_all_4);
208 newres = _DtCm_rtable_delete_4_svc(newargs, svcrq);
209 res = _DtCm_tableres4_to_tableres2(newres);
211 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
218 _DtCm_rtable_delete_instance_2_svc(args, svcrq)
220 struct svc_req *svcrq;
222 static Table_Res_2 *res = NULL;
223 Table_Args_4 *newargs;
226 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res);
228 newargs = _DtCm_tabledelargs2_to_tabledelargs4(args, do_one_4);
229 newres = _DtCm_rtable_delete_4_svc(newargs, svcrq);
230 res = _DtCm_tableres4_to_tableres2(newres);
232 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
239 _DtCm_rtable_change_2_svc(args, svcrq)
241 struct svc_req *svcrq;
243 static Table_Res_2 *res = NULL;
244 Table_Args_4 *newargs;
247 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res);
249 newargs = _DtCm_tableargs2_to_tableargs4(args);
250 newres = _DtCm_rtable_change_4_svc(newargs, svcrq);
251 res = _DtCm_tableres4_to_tableres2(newres);
253 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
261 _DtCm_rtable_change_instance_2_svc(args, svcrq)
263 struct svc_req *svcrq;
265 static Table_Res_2 *res = NULL;
266 Table_Args_4 *newargs;
269 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res);
271 newargs = _DtCm_tableargs2_to_tableargs4(args);
272 newargs->args.Args_4_u.apptid.option = do_one_4;
273 newres = _DtCm_rtable_change_4_svc(newargs, svcrq);
274 res = _DtCm_tableres4_to_tableres2(newres);
276 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
283 _DtCm_rtable_lookup_next_reminder_2_svc(args, svcrq)
285 struct svc_req *svcrq;
287 static Table_Res_2 *res = NULL;
288 Table_Args_4 *newargs;
291 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res);
293 newargs = _DtCm_tableargs2_to_tableargs4(args);
294 newres = _DtCm_rtable_lookup_next_reminder_4_svc(newargs, svcrq);
296 res = _DtCm_tableres4_to_tableres2(newres);
298 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
304 extern Table_Status_2 *
305 _DtCm_rtable_check_2_svc(args, svcrq)
307 struct svc_req *svcrq;
309 static Table_Status_2 res;
310 Table_Args_4 *newargs;
311 Table_Status_4 *newres;
313 newargs = _DtCm_tableargs2_to_tableargs4(args);
314 newres = _DtCm_rtable_check_4_svc(newargs, svcrq);
316 res = _DtCm_tablestat4_to_tablestat2(*newres);
318 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
324 extern Table_Status_2 *
325 _DtCm_rtable_flush_table_2_svc(args, svcrq)
327 struct svc_req *svcrq;
329 static Table_Status_2 res;
330 Table_Args_4 *newargs;
331 Table_Status_4 *newres;
333 newargs = _DtCm_tableargs2_to_tableargs4(args);
334 newres = _DtCm_rtable_flush_table_4_svc(newargs, svcrq);
336 res = _DtCm_tablestat4_to_tablestat2(*newres);
338 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
345 _DtCm_rtable_size_2_svc(args, svcrq)
347 struct svc_req *svcrq;
350 Table_Args_4 *newargs;
352 newargs = _DtCm_tableargs2_to_tableargs4(args);
353 size = (*(_DtCm_rtable_size_4_svc(newargs, svcrq)));
355 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
361 Registration_Status_2 *
362 _DtCm_register_callback_2_svc(r, svcrq)
364 struct svc_req *svcrq;
366 static Registration_Status_2 stat;
367 Registration_4 *newreg;
368 Registration_Status_4 *newstat;
370 newreg = _DtCm_reg2_to_reg4(r);
371 newstat = _DtCm_register_callback_4_svc(newreg, svcrq);
373 stat = _DtCm_regstat4_to_regstat2(*newstat);
375 if (newreg!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Registration_4, (char*)newreg);
380 Registration_Status_2 *
381 _DtCm_deregister_callback_2_svc(r, svcrq)
383 struct svc_req *svcrq;
385 static Registration_Status_2 stat;
386 Registration_4 *newreg;
387 Registration_Status_4 *newstat;
389 newreg = _DtCm_reg2_to_reg4(r);
390 newstat = _DtCm_deregister_callback_4_svc(newreg, svcrq);
392 stat = _DtCm_regstat4_to_regstat2(*newstat);
394 if (newreg!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Registration_4, (char*)newreg);
399 extern Access_Status_2 *
400 _DtCm_rtable_set_access_2_svc(args, svcrq)
402 struct svc_req *svcrq;
404 static Access_Status_2 stat;
405 Access_Args_4 *newargs;
406 Access_Status_4 *newstat;
408 newargs = _DtCm_accargs2_to_accargs4(args);
409 newstat = _DtCm_rtable_set_access_4_svc(newargs, svcrq);
411 stat = _DtCm_accstat4_to_accstat2(*newstat);
413 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_4, (char*)newargs);
418 extern Access_Args_2 *
419 _DtCm_rtable_get_access_2_svc(args, svcrq)
421 struct svc_req *svcrq;
423 static Access_Args_2 *res = NULL;
424 Access_Args_4 *newargs;
425 Access_Args_4 *newres;
427 if (res!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_2, (char*)res);
429 newargs = _DtCm_accargs2_to_accargs4(args);
430 newres = _DtCm_rtable_get_access_4_svc(newargs, svcrq);
432 res = _DtCm_accargs4_to_accargs2(newres);
434 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_4, (char*)newargs);
442 int ver = TABLEVERS_2;
443 ph->program_num = TABLEPROG;
444 ph->prog[TABLEVERS_2].vers = &tableprog_2_table[0];
445 ph->prog[TABLEVERS_2].nproc = sizeof(tableprog_2_table)/sizeof(tableprog_2_table[0]);