1 /* Copyright (c) 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #include <rpcsvc/nis.h>
23 xdr_nis_attr (XDR
*xdrs
, nis_attr
*objp
)
25 if (!xdr_string (xdrs
, &objp
->zattr_ndx
, ~0))
27 if (!xdr_bytes (xdrs
, (char **) &objp
->zattr_val
.zattr_val_val
,
28 (u_int
*) & objp
->zattr_val
.zattr_val_len
, ~0))
34 xdr_nis_name (XDR
*xdrs
, nis_name
*objp
)
36 if (!xdr_string (xdrs
, objp
, ~0))
42 xdr_zotypes (XDR
*xdrs
, zotypes
*objp
)
44 if (!xdr_enum (xdrs
, (enum_t
*) objp
))
50 xdr_nstype (XDR
*xdrs
, nstype
*objp
)
52 if (!xdr_enum (xdrs
, (enum_t
*) objp
))
58 xdr_oar_mask (XDR
*xdrs
, oar_mask
*objp
)
60 if (!xdr_u_long (xdrs
, &objp
->oa_rights
))
62 if (!xdr_zotypes (xdrs
, &objp
->oa_otype
))
68 xdr_endpoint (XDR
*xdrs
, endpoint
*objp
)
70 if (!xdr_string (xdrs
, &objp
->uaddr
, ~0))
72 if (!xdr_string (xdrs
, &objp
->family
, ~0))
74 if (!xdr_string (xdrs
, &objp
->proto
, ~0))
80 xdr_nis_server (XDR
*xdrs
, nis_server
*objp
)
82 if (!xdr_nis_name (xdrs
, &objp
->name
))
84 if (!xdr_array (xdrs
, (char **) &objp
->ep
.ep_val
, (u_int
*) &objp
->ep
.ep_len
,
85 ~0, sizeof (endpoint
), (xdrproc_t
) xdr_endpoint
))
87 if (!xdr_u_long (xdrs
, &objp
->key_type
))
89 if (!xdr_netobj (xdrs
, &objp
->pkey
))
95 xdr_directory_obj (XDR
*xdrs
, directory_obj
*objp
)
97 if (!xdr_nis_name (xdrs
, &objp
->do_name
))
99 if (!xdr_nstype (xdrs
, &objp
->do_type
))
101 if (!xdr_array (xdrs
, (char **) &objp
->do_servers
.do_servers_val
,
102 (u_int
*) & objp
->do_servers
.do_servers_len
, ~0,
103 sizeof (nis_server
), (xdrproc_t
) xdr_nis_server
))
106 if (!xdr_u_long (xdrs
, &objp
->do_ttl
))
108 if (!xdr_array (xdrs
, (char **) &objp
->do_armask
.do_armask_val
,
109 (u_int
*) & objp
->do_armask
.do_armask_len
, ~0,
110 sizeof (oar_mask
), (xdrproc_t
) xdr_oar_mask
))
116 xdr_entry_col (XDR
*xdrs
, entry_col
*objp
)
118 if (!xdr_u_long (xdrs
, &objp
->ec_flags
))
120 if (!xdr_bytes (xdrs
, (char **) &objp
->ec_value
.ec_value_val
,
121 (u_int
*) &objp
->ec_value
.ec_value_len
, ~0))
127 xdr_entry_obj (XDR
*xdrs
, entry_obj
*objp
)
129 if (!xdr_string (xdrs
, &objp
->en_type
, ~0))
131 if (!xdr_array (xdrs
, (char **) &objp
->en_cols
.en_cols_val
,
132 (u_int
*) &objp
->en_cols
.en_cols_len
, ~0,
133 sizeof (entry_col
), (xdrproc_t
) xdr_entry_col
))
139 xdr_group_obj (XDR
*xdrs
, group_obj
*objp
)
141 if (!xdr_u_long (xdrs
, &objp
->gr_flags
))
143 if (!xdr_array (xdrs
, (char **) &objp
->gr_members
.gr_members_val
,
144 (u_int
*) &objp
->gr_members
.gr_members_len
, ~0,
145 sizeof (nis_name
), (xdrproc_t
) xdr_nis_name
))
151 xdr_link_obj (XDR
*xdrs
, link_obj
*objp
)
153 if (!xdr_zotypes (xdrs
, &objp
->li_rtype
))
155 if (!xdr_array (xdrs
, (char **) &objp
->li_attrs
.li_attrs_val
,
156 (u_int
*) &objp
->li_attrs
.li_attrs_len
, ~0,
157 sizeof (nis_attr
), (xdrproc_t
) xdr_nis_attr
))
159 if (!xdr_nis_name (xdrs
, &objp
->li_name
))
165 xdr_table_col (XDR
*xdrs
, table_col
*objp
)
167 if (!xdr_string (xdrs
, &objp
->tc_name
, 64))
169 if (!xdr_u_long (xdrs
, &objp
->tc_flags
))
171 if (!xdr_u_long (xdrs
, &objp
->tc_rights
))
177 xdr_table_obj (XDR
*xdrs
, table_obj
*objp
)
179 if (!xdr_string (xdrs
, &objp
->ta_type
, 64))
181 if (!xdr_int (xdrs
, &objp
->ta_maxcol
))
183 if (!xdr_u_char (xdrs
, &objp
->ta_sep
))
185 if (!xdr_array (xdrs
, (char **) &objp
->ta_cols
.ta_cols_val
,
186 (u_int
*) &objp
->ta_cols
.ta_cols_len
, ~0,
187 sizeof (table_col
), (xdrproc_t
) xdr_table_col
))
189 if (!xdr_string (xdrs
, &objp
->ta_path
, ~0))
195 xdr_objdata (XDR
*xdrs
, objdata
*objp
)
197 if (!xdr_zotypes (xdrs
, &objp
->zo_type
))
199 switch (objp
->zo_type
)
201 case NIS_DIRECTORY_OBJ
:
202 if (!xdr_directory_obj (xdrs
, &objp
->objdata_u
.di_data
))
206 if (!xdr_group_obj (xdrs
, &objp
->objdata_u
.gr_data
))
210 if (!xdr_table_obj (xdrs
, &objp
->objdata_u
.ta_data
))
214 if (!xdr_entry_obj (xdrs
, &objp
->objdata_u
.en_data
))
218 if (!xdr_link_obj (xdrs
, &objp
->objdata_u
.li_data
))
221 case NIS_PRIVATE_OBJ
:
222 if (!xdr_bytes (xdrs
, (char **) &objp
->objdata_u
.po_data
.po_data_val
,
223 (u_int
*) & objp
->objdata_u
.po_data
.po_data_len
, ~0))
237 xdr_nis_oid (XDR
*xdrs
, nis_oid
*objp
)
239 if (!xdr_u_long (xdrs
, &objp
->ctime
))
241 if (!xdr_u_long (xdrs
, &objp
->mtime
))
247 xdr_nis_object (XDR
*xdrs
, nis_object
*objp
)
249 if (!xdr_nis_oid (xdrs
, &objp
->zo_oid
))
251 if (!xdr_nis_name (xdrs
, &objp
->zo_name
))
253 if (!xdr_nis_name (xdrs
, &objp
->zo_owner
))
255 if (!xdr_nis_name (xdrs
, &objp
->zo_group
))
257 if (!xdr_nis_name (xdrs
, &objp
->zo_domain
))
259 if (!xdr_u_long (xdrs
, &objp
->zo_access
))
261 if (!xdr_u_long (xdrs
, &objp
->zo_ttl
))
263 if (!xdr_objdata (xdrs
, &objp
->zo_data
))
269 xdr_nis_error (XDR
*xdrs
, nis_error
*objp
)
271 if (!xdr_enum (xdrs
, (enum_t
*) objp
))
277 xdr_nis_result (XDR
*xdrs
, nis_result
*objp
)
281 if (xdrs
->x_op
== XDR_ENCODE
)
283 if (!xdr_nis_error (xdrs
, &objp
->status
))
285 if (!xdr_array (xdrs
, (char **) &objp
->objects
.objects_val
,
286 (u_int
*) &objp
->objects
.objects_len
, ~0,
287 sizeof (nis_object
), (xdrproc_t
) xdr_nis_object
))
289 if (!xdr_netobj (xdrs
, &objp
->cookie
))
291 buf
= XDR_INLINE (xdrs
, 4 * BYTES_PER_XDR_UNIT
);
294 if (!xdr_u_long (xdrs
, &objp
->zticks
))
298 if (!xdr_u_long (xdrs
, &objp
->dticks
))
302 if (!xdr_u_long (xdrs
, &objp
->aticks
))
306 if (!xdr_u_long (xdrs
, &objp
->cticks
))
314 IXDR_PUT_U_LONG (buf
, objp
->zticks
);
315 IXDR_PUT_U_LONG (buf
, objp
->dticks
);
316 IXDR_PUT_U_LONG (buf
, objp
->aticks
);
317 IXDR_PUT_U_LONG (buf
, objp
->cticks
);
322 else if (xdrs
->x_op
== XDR_DECODE
)
324 if (!xdr_nis_error (xdrs
, &objp
->status
))
328 if (!xdr_array (xdrs
, (char **) &objp
->objects
.objects_val
,
329 (u_int
*) &objp
->objects
.objects_len
, ~0,
330 sizeof (nis_object
), (xdrproc_t
) xdr_nis_object
))
334 if (!xdr_netobj (xdrs
, &objp
->cookie
))
338 buf
= XDR_INLINE (xdrs
, 4 * BYTES_PER_XDR_UNIT
);
341 if (!xdr_u_long (xdrs
, &objp
->zticks
))
345 if (!xdr_u_long (xdrs
, &objp
->dticks
))
349 if (!xdr_u_long (xdrs
, &objp
->aticks
))
353 if (!xdr_u_long (xdrs
, &objp
->cticks
))
361 objp
->zticks
= IXDR_GET_U_LONG (buf
);
362 objp
->dticks
= IXDR_GET_U_LONG (buf
);
363 objp
->aticks
= IXDR_GET_U_LONG (buf
);
364 objp
->cticks
= IXDR_GET_U_LONG (buf
);
369 if (!xdr_nis_error (xdrs
, &objp
->status
))
373 if (!xdr_array (xdrs
, (char **) &objp
->objects
.objects_val
,
374 (u_int
*) &objp
->objects
.objects_len
, ~0,
375 sizeof (nis_object
), (xdrproc_t
) xdr_nis_object
))
379 if (!xdr_netobj (xdrs
, &objp
->cookie
))
383 if (!xdr_u_long (xdrs
, &objp
->zticks
))
387 if (!xdr_u_long (xdrs
, &objp
->dticks
))
391 if (!xdr_u_long (xdrs
, &objp
->aticks
))
395 if (!xdr_u_long (xdrs
, &objp
->cticks
))
403 xdr_ns_request (XDR
*xdrs
, ns_request
*objp
)
405 if (!xdr_nis_name (xdrs
, &objp
->ns_name
))
407 if (!xdr_array (xdrs
, (char **) &objp
->ns_object
.ns_object_val
,
408 (u_int
*) &objp
->ns_object
.ns_object_len
, 1,
409 sizeof (nis_object
), (xdrproc_t
) xdr_nis_object
))
415 xdr_ib_request (XDR
*xdrs
, ib_request
*objp
)
417 if (!xdr_nis_name (xdrs
, &objp
->ibr_name
))
419 if (!xdr_array (xdrs
, (char **) &objp
->ibr_srch
.ibr_srch_val
,
420 (u_int
*) &objp
->ibr_srch
.ibr_srch_len
, ~0,
421 sizeof (nis_attr
), (xdrproc_t
) xdr_nis_attr
))
423 if (!xdr_u_long (xdrs
, &objp
->ibr_flags
))
425 if (!xdr_array (xdrs
, (char **) &objp
->ibr_obj
.ibr_obj_val
,
426 (u_int
*) &objp
->ibr_obj
.ibr_obj_len
, 1,
427 sizeof (nis_object
), (xdrproc_t
) xdr_nis_object
))
429 if (!xdr_array (xdrs
, (char **) &objp
->ibr_cbhost
.ibr_cbhost_val
,
430 (u_int
*) &objp
->ibr_cbhost
.ibr_cbhost_len
, 1,
431 sizeof (nis_server
), (xdrproc_t
) xdr_nis_server
))
433 if (!xdr_u_long (xdrs
, &objp
->ibr_bufsize
))
435 if (!xdr_netobj (xdrs
, &objp
->ibr_cookie
))
441 xdr_ping_args (XDR
*xdrs
, ping_args
*objp
)
443 if (!xdr_nis_name (xdrs
, &objp
->dir
))
445 if (!xdr_u_long (xdrs
, &objp
->stamp
))
451 xdr_log_entry_t (XDR
*xdrs
, log_entry_t
*objp
)
453 if (!xdr_enum (xdrs
, (enum_t
*) objp
))
459 xdr_log_entry (XDR
*xdrs
, log_entry
*objp
)
461 if (!xdr_u_long (xdrs
, &objp
->le_time
))
463 if (!xdr_log_entry_t (xdrs
, &objp
->le_type
))
465 if (!xdr_nis_name (xdrs
, &objp
->le_princp
))
467 if (!xdr_nis_name (xdrs
, &objp
->le_name
))
469 if (!xdr_array (xdrs
, (char **) &objp
->le_attrs
.le_attrs_val
,
470 (u_int
*) &objp
->le_attrs
.le_attrs_len
, ~0,
471 sizeof (nis_attr
), (xdrproc_t
) xdr_nis_attr
))
473 if (!xdr_nis_object (xdrs
, &objp
->le_object
))
479 xdr_log_result (XDR
*xdrs
, log_result
*objp
)
481 if (!xdr_nis_error (xdrs
, &objp
->lr_status
))
485 if (!xdr_netobj (xdrs
, &objp
->lr_cookie
))
489 if (!xdr_array (xdrs
, (char **) &objp
->lr_entries
.lr_entries_val
,
490 (u_int
*) &objp
->lr_entries
.lr_entries_len
, ~0,
491 sizeof (log_entry
), (xdrproc_t
) xdr_log_entry
))
499 xdr_cp_result (XDR
*xdrs
, cp_result
*objp
)
501 if (!xdr_nis_error (xdrs
, &objp
->cp_status
))
503 if (!xdr_u_long (xdrs
, &objp
->cp_zticks
))
505 if (!xdr_u_long (xdrs
, &objp
->cp_dticks
))
511 xdr_nis_tag (XDR
*xdrs
, nis_tag
*objp
)
513 if (!xdr_u_long (xdrs
, &objp
->tag_type
))
517 if (!xdr_string (xdrs
, &objp
->tag_val
, 1024))
525 xdr_nis_taglist (XDR
*xdrs
, nis_taglist
*objp
)
527 if (!xdr_array (xdrs
, (char **) &objp
->tags
.tags_val
,
528 (u_int
*) &objp
->tags
.tags_len
, ~0, sizeof (nis_tag
),
529 (xdrproc_t
) xdr_nis_tag
))
535 xdr_dump_args (XDR
*xdrs
, dump_args
*objp
)
537 if (!xdr_nis_name (xdrs
, &objp
->da_dir
))
539 if (!xdr_u_long (xdrs
, &objp
->da_time
))
541 if (!xdr_array (xdrs
, (char **) &objp
->da_cbhost
.da_cbhost_val
,
542 (u_int
*) &objp
->da_cbhost
.da_cbhost_len
, 1,
543 sizeof (nis_server
), (xdrproc_t
) xdr_nis_server
))
549 xdr_fd_args (XDR
*xdrs
, fd_args
*objp
)
551 if (!xdr_nis_name (xdrs
, &objp
->dir_name
))
553 if (!xdr_nis_name (xdrs
, &objp
->requester
))
559 xdr_fd_result (XDR
*xdrs
, fd_result
*objp
)
561 if (!xdr_nis_error (xdrs
, &objp
->status
))
563 if (!xdr_nis_name (xdrs
, &objp
->source
))
565 if (!xdr_bytes (xdrs
, (char **) &objp
->dir_data
.dir_data_val
,
566 (u_int
*) &objp
->dir_data
.dir_data_len
, ~0))
568 if (!xdr_bytes (xdrs
, (char **) &objp
->signature
.signature_val
,
569 (u_int
*) &objp
->signature
.signature_len
, ~0))