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 libraries 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(void *args, struct svc_req *svcrq)
55 return(NULL); /* for RPC reply */
60 _DtCm_rtable_lookup_2_svc (Table_Args_2 *args, struct svc_req *svcrq)
62 static Table_Res_2 *res = NULL;
63 Table_Args_4 *newargs;
66 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res); res = NULL;
68 newargs = _DtCm_tableargs2_to_tableargs4(args);
70 newres = _DtCm_rtable_lookup_4_svc(newargs, svcrq);
72 res = _DtCm_tableres4_to_tableres2(newres);
74 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
82 _DtCm_rtable_lookup_next_larger_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
84 static Table_Res_2 *res = NULL;
85 Table_Args_4 *newargs;
88 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res); res = NULL;
90 newargs = _DtCm_tableargs2_to_tableargs4(args);
92 newres = _DtCm_rtable_lookup_next_larger_4_svc(newargs, svcrq);
93 res = _DtCm_tableres4_to_tableres2(newres);
95 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
104 _DtCm_rtable_lookup_next_smaller_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
106 static Table_Res_2 *res = NULL;
107 Table_Args_4 *newargs;
110 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res); res = NULL;
112 newargs = _DtCm_tableargs2_to_tableargs4(args);
114 newres = _DtCm_rtable_lookup_next_smaller_4_svc(newargs, svcrq);
116 res = _DtCm_tableres4_to_tableres2(newres);
118 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
127 _DtCm_rtable_lookup_range_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
129 static Table_Res_2 *res = NULL;
130 Table_Args_4 *newargs;
133 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res); res = NULL;
135 newargs = _DtCm_tableargs2_to_tableargs4(args);
137 newres = _DtCm_rtable_lookup_range_4_svc(newargs, svcrq);
139 res = _DtCm_tableres4_to_tableres2(newres);
141 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
149 _DtCm_rtable_abbreviated_lookup_range_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
151 static Table_Res_2 *res = NULL;
152 Table_Args_4 *newargs;
155 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res); res = NULL;
157 newargs = _DtCm_tableargs2_to_tableargs4(args);
159 newres = _DtCm_rtable_abbreviated_lookup_range_4_svc(newargs, svcrq);
161 res = _DtCm_tableres4_to_tableres2(newres);
163 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
171 _DtCm_rtable_insert_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
173 static Table_Res_2 *res = NULL;
174 Table_Args_4 *newargs;
177 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res); res = NULL;
179 newargs = _DtCm_tableargs2_to_tableargs4(args);
181 newres = _DtCm_rtable_insert_4_svc(newargs, svcrq);
183 res = _DtCm_tableres4_to_tableres2(newres);
185 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
193 _DtCm_rtable_delete_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
195 static Table_Res_2 *res = NULL;
196 Table_Args_4 *newargs;
199 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res); res = NULL;
201 newargs = _DtCm_tabledelargs2_to_tabledelargs4(args, do_all_4);
203 newres = _DtCm_rtable_delete_4_svc(newargs, svcrq);
204 res = _DtCm_tableres4_to_tableres2(newres);
206 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
213 _DtCm_rtable_delete_instance_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
215 static Table_Res_2 *res = NULL;
216 Table_Args_4 *newargs;
219 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res); res = NULL;
221 newargs = _DtCm_tabledelargs2_to_tabledelargs4(args, do_one_4);
223 newres = _DtCm_rtable_delete_4_svc(newargs, svcrq);
224 res = _DtCm_tableres4_to_tableres2(newres);
226 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
234 _DtCm_rtable_change_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
236 static Table_Res_2 *res = NULL;
237 Table_Args_4 *newargs;
240 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res); res = NULL;
242 newargs = _DtCm_tableargs2_to_tableargs4(args);
244 newres = _DtCm_rtable_change_4_svc(newargs, svcrq);
245 res = _DtCm_tableres4_to_tableres2(newres);
247 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
256 _DtCm_rtable_change_instance_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
258 static Table_Res_2 *res = NULL;
259 Table_Args_4 *newargs;
262 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res); res = NULL;
264 newargs = _DtCm_tableargs2_to_tableargs4(args);
266 newargs->args.Args_4_u.apptid.option = do_one_4;
267 newres = _DtCm_rtable_change_4_svc(newargs, svcrq);
268 res = _DtCm_tableres4_to_tableres2(newres);
270 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
278 _DtCm_rtable_lookup_next_reminder_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
280 static Table_Res_2 *res = NULL;
281 Table_Args_4 *newargs;
284 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_2, (char*)res); res = NULL;
286 newargs = _DtCm_tableargs2_to_tableargs4(args);
288 newres = _DtCm_rtable_lookup_next_reminder_4_svc(newargs, svcrq);
290 res = _DtCm_tableres4_to_tableres2(newres);
292 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
299 extern Table_Status_2 *
300 _DtCm_rtable_check_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
302 static Table_Status_2 res;
303 Table_Args_4 *newargs;
304 Table_Status_4 *newres;
308 newargs = _DtCm_tableargs2_to_tableargs4(args);
310 newres = _DtCm_rtable_check_4_svc(newargs, svcrq);
312 res = _DtCm_tablestat4_to_tablestat2(*newres);
314 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
321 extern Table_Status_2 *
322 _DtCm_rtable_flush_table_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
324 static Table_Status_2 res;
325 Table_Args_4 *newargs;
326 Table_Status_4 *newres;
330 newargs = _DtCm_tableargs2_to_tableargs4(args);
331 newres = _DtCm_rtable_flush_table_4_svc(newargs, svcrq);
333 res = _DtCm_tablestat4_to_tablestat2(*newres);
335 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
342 _DtCm_rtable_size_2_svc(Table_Args_2 *args, struct svc_req *svcrq)
345 Table_Args_4 *newargs;
349 newargs = _DtCm_tableargs2_to_tableargs4(args);
351 size = (*(_DtCm_rtable_size_4_svc(newargs, svcrq)));
353 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
360 Registration_Status_2 *
361 _DtCm_register_callback_2_svc(Registration_2 *r, struct svc_req *svcrq)
363 static Registration_Status_2 stat;
364 Registration_4 *newreg;
365 Registration_Status_4 *newstat;
369 newreg = _DtCm_reg2_to_reg4(r);
371 newstat = _DtCm_register_callback_4_svc(newreg, svcrq);
372 stat = _DtCm_regstat4_to_regstat2(*newstat);
374 xdr_free((xdrproc_t)_DtCm_xdr_Registration_4, (char*)newreg);
380 Registration_Status_2 *
381 _DtCm_deregister_callback_2_svc(Registration_2 *r, struct svc_req *svcrq)
383 static Registration_Status_2 stat;
384 Registration_4 *newreg;
385 Registration_Status_4 *newstat;
389 newreg = _DtCm_reg2_to_reg4(r);
391 newstat = _DtCm_deregister_callback_4_svc(newreg, svcrq);
393 stat = _DtCm_regstat4_to_regstat2(*newstat);
395 xdr_free((xdrproc_t)_DtCm_xdr_Registration_4, (char*)newreg);
401 extern Access_Status_2 *
402 _DtCm_rtable_set_access_2_svc(Access_Args_2 *args, struct svc_req *svcrq)
404 static Access_Status_2 stat;
405 Access_Args_4 *newargs;
406 Access_Status_4 *newstat;
410 newargs = _DtCm_accargs2_to_accargs4(args);
412 newstat = _DtCm_rtable_set_access_4_svc(newargs, svcrq);
414 stat = _DtCm_accstat4_to_accstat2(*newstat);
416 xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_4, (char*)newargs);
423 extern Access_Args_2 *
424 _DtCm_rtable_get_access_2_svc(Access_Args_2 *args, struct svc_req *svcrq)
426 static Access_Args_2 *res = NULL;
427 Access_Args_4 *newargs;
428 Access_Args_4 *newres;
430 if (res!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_2, (char*)res); res = NULL;
432 newargs = _DtCm_accargs2_to_accargs4(args);
434 newres = _DtCm_rtable_get_access_4_svc(newargs, svcrq);
436 res = _DtCm_accargs4_to_accargs2(newres);
438 xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_4, (char*)newargs);
444 void initrtable2(program_handle ph)
446 int ver = TABLEVERS_2;
447 ph->program_num = TABLEPROG;
448 ph->prog[TABLEVERS_2].vers = &tableprog_2_table[0];
449 ph->prog[TABLEVERS_2].nproc = sizeof(tableprog_2_table)/sizeof(tableprog_2_table[0]);