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: rtable3.c /main/4 1995/11/09 12:51:59 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 3 in terms of Version 4 types
38 #include <EUSCompat.h>
42 #include <sys/param.h>
45 #include "rpcextras.h"
46 #include "convert3-4.h"
47 #include "convert4-3.h"
48 #include "rtable3_tbl.i"
51 /*************** V3 PROTOCOL IMPLEMENTATION PROCS *****************/
53 _DtCm_rtable_ping_3_svc(void *args, struct svc_req *svcrq)
55 return(NULL); /* for RPC reply */
60 _DtCm_rtable_lookup_3_svc (Table_Args_3 *args, struct svc_req *svcrq)
62 static Table_Res_3 *res = NULL;
63 Table_Args_4 *newargs;
66 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
68 newargs = _DtCm_tableargs3_to_tableargs4(args);
70 newres = _DtCm_rtable_lookup_4_svc(newargs, svcrq);
71 res = _DtCm_tableres4_to_tableres3(newres);
73 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
81 _DtCm_rtable_lookup_next_larger_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
83 static Table_Res_3 *res = NULL;
84 Table_Args_4 *newargs;
87 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
89 newargs = _DtCm_tableargs3_to_tableargs4(args);
91 newres = _DtCm_rtable_lookup_next_larger_4_svc(newargs, svcrq);
92 res = _DtCm_tableres4_to_tableres3(newres);
94 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
102 _DtCm_rtable_lookup_next_smaller_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
104 static Table_Res_3 *res = NULL;
105 Table_Args_4 *newargs;
108 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
110 newargs = _DtCm_tableargs3_to_tableargs4(args);
112 newres = _DtCm_rtable_lookup_next_smaller_4_svc(newargs, svcrq);
113 res = _DtCm_tableres4_to_tableres3(newres);
115 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
123 _DtCm_rtable_lookup_range_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
125 static Table_Res_3 *res = NULL;
126 Table_Args_4 *newargs;
129 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
131 newargs = _DtCm_tableargs3_to_tableargs4(args);
133 newres = _DtCm_rtable_lookup_range_4_svc(newargs, svcrq);
134 res = _DtCm_tableres4_to_tableres3(newres);
136 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
144 _DtCm_rtable_abbreviated_lookup_range_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
146 static Table_Res_3 *res = NULL;
147 Table_Args_4 *newargs;
150 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
152 newargs = _DtCm_tableargs3_to_tableargs4(args);
154 newres = _DtCm_rtable_abbreviated_lookup_range_4_svc(newargs, svcrq);
155 res = _DtCm_tableres4_to_tableres3(newres);
157 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
165 _DtCm_rtable_insert_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
167 static Table_Res_3 *res = NULL;
168 Table_Args_4 *newargs;
171 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
173 newargs = _DtCm_tableargs3_to_tableargs4(args);
175 newres = _DtCm_rtable_insert_4_svc(newargs, svcrq);
176 res = _DtCm_tableres4_to_tableres3(newres);
178 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
186 _DtCm_rtable_delete_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
188 static Table_Res_3 *res = NULL;
189 Table_Args_4 *newargs;
192 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
194 newargs = _DtCm_tabledelargs3_to_tabledelargs4(args, do_all_4);
196 newres = _DtCm_rtable_delete_4_svc(newargs, svcrq);
197 res = _DtCm_tableres4_to_tableres3(newres);
199 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
207 _DtCm_rtable_delete_instance_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
209 static Table_Res_3 *res = NULL;
210 Table_Args_4 *newargs;
213 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
215 newargs = _DtCm_tabledelargs3_to_tabledelargs4(args, do_one_4);
217 newres = _DtCm_rtable_delete_4_svc(newargs, svcrq);
218 res = _DtCm_tableres4_to_tableres3(newres);
220 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
228 _DtCm_rtable_change_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
230 static Table_Res_3 *res = NULL;
231 Table_Args_4 *newargs;
234 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
236 newargs = _DtCm_tableargs3_to_tableargs4(args);
238 newres = _DtCm_rtable_change_4_svc(newargs, svcrq);
239 res = _DtCm_tableres4_to_tableres3(newres);
241 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
250 _DtCm_rtable_change_instance_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
252 static Table_Res_3 *res = NULL;
253 Table_Args_4 *newargs;
256 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
258 newargs = _DtCm_tableargs3_to_tableargs4(args);
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);
264 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
272 _DtCm_rtable_lookup_next_reminder_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
274 static Table_Res_3 *res = NULL;
275 Table_Args_4 *newargs;
278 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
280 newargs = _DtCm_tableargs3_to_tableargs4(args);
282 newres = _DtCm_rtable_lookup_next_reminder_4_svc(newargs, svcrq);
283 res = _DtCm_tableres4_to_tableres3(newres);
285 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
292 extern Table_Status_3 *
293 _DtCm_rtable_check_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
295 static Table_Status_3 res;
296 Table_Args_4 *newargs;
297 Table_Status_4 *newres;
301 newargs = _DtCm_tableargs3_to_tableargs4(args);
303 newres = _DtCm_rtable_check_4_svc(newargs, svcrq);
304 res = _DtCm_tablestat4_to_tablestat3(*newres);
306 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
313 extern Table_Status_3 *
314 _DtCm_rtable_flush_table_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
316 static Table_Status_3 res;
317 Table_Args_4 *newargs;
318 Table_Status_4 *newres;
322 newargs = _DtCm_tableargs3_to_tableargs4(args);
323 newres = _DtCm_rtable_flush_table_4_svc(newargs, svcrq);
324 res = _DtCm_tablestat4_to_tablestat3(*newres);
326 if (newargs!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
333 _DtCm_rtable_size_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
336 Table_Args_4 *newargs;
340 newargs = _DtCm_tableargs3_to_tableargs4(args);
342 size = (*(_DtCm_rtable_size_4_svc(newargs, svcrq)));
344 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
351 Registration_Status_3 *
352 _DtCm_register_callback_3_svc(Registration_3 *r, struct svc_req *svcrq)
354 static Registration_Status_3 stat;
355 Registration_4 *newreg;
356 Registration_Status_4 *newstat;
360 newreg = _DtCm_reg3_to_reg4(r);
362 newstat = _DtCm_register_callback_4_svc(newreg, svcrq);
363 stat = _DtCm_regstat4_to_regstat3(*newstat);
365 xdr_free((xdrproc_t)_DtCm_xdr_Registration_4, (char*)newreg);
371 Registration_Status_3 *
372 _DtCm_deregister_callback_3_svc(Registration_3 *r, struct svc_req *svcrq)
374 static Registration_Status_3 stat;
375 Registration_4 *newreg;
376 Registration_Status_4 *newstat;
380 newreg = _DtCm_reg3_to_reg4(r);
382 newstat = _DtCm_deregister_callback_4_svc(newreg, svcrq);
383 stat = _DtCm_regstat4_to_regstat3(*newstat);
385 xdr_free((xdrproc_t)_DtCm_xdr_Registration_4, (char*)newreg);
391 extern Access_Status_3 *
392 _DtCm_rtable_set_access_3_svc(Access_Args_3 *args, struct svc_req *svcrq)
394 static Access_Status_3 stat;
395 Access_Args_4 *newargs;
396 Access_Status_4 *newstat;
400 newargs = _DtCm_accargs3_to_accargs4(args);
402 newstat = _DtCm_rtable_set_access_4_svc(newargs, svcrq);
403 stat = _DtCm_accstat4_to_accstat3(*newstat);
405 xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_4, (char*)newargs);
411 extern Access_Args_3 *
412 _DtCm_rtable_get_access_3_svc(Access_Args_3 *args, struct svc_req *svcrq)
414 static Access_Args_3 *res = NULL;
415 Access_Args_4 *newargs;
416 Access_Args_4 *newres;
418 if (res!=NULL) xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_3, (char*)res); res = NULL;
420 newargs = _DtCm_accargs3_to_accargs4(args);
422 newres = _DtCm_rtable_get_access_4_svc(newargs, svcrq);
423 res = _DtCm_accargs4_to_accargs3(newres);
425 xdr_free((xdrproc_t)_DtCm_xdr_Access_Args_4, (char*)newargs);
432 _DtCm_rtable_abbreviated_lookup_key_range_3_svc(Table_Args_3 *args, struct svc_req *svcrq)
434 static Table_Res_3 *res = NULL;
435 Table_Args_4 *newargs;
438 if (res!=NULL) xdr_free ((xdrproc_t)_DtCm_xdr_Table_Res_3, (char*)res); res = NULL;
440 newargs = _DtCm_tableargs3_to_tableargs4(args);
442 newres = _DtCm_rtable_abbreviated_lookup_key_range_4_svc(newargs, svcrq);
443 res = _DtCm_tableres4_to_tableres3(newres);
445 xdr_free((xdrproc_t)_DtCm_xdr_Table_Args_4, (char*)newargs);
452 _DtCm_rtable_gmtoff_3_svc(void *args, struct svc_req *svcrq)
456 gmtoff = (*(_DtCm_rtable_gmtoff_4_svc(NULL, svcrq)));
461 void initrtable3(program_handle ph)
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]);