1 /* Copyright (c) 1997, 1998 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 Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #include <rpcsvc/nis.h>
21 #include <rpcsvc/nis_callback.h> /* for "official" Solaris xdr functions */
23 /* This functions do exist without beginning "_" under Solaris 2.x, but
24 we have no prototypes for them. To avoid the same problems as with the
25 YP xdr functions, we don't make them public. */
29 xdr_nis_attr (XDR
*xdrs
, nis_attr
*objp
)
31 if (!xdr_string (xdrs
, &objp
->zattr_ndx
, ~0))
33 if (!xdr_bytes (xdrs
, (char **) &objp
->zattr_val
.zattr_val_val
,
34 (u_int
*) & objp
->zattr_val
.zattr_val_len
, ~0))
40 _xdr_nis_name (XDR
*xdrs
, nis_name
*objp
)
42 if (!xdr_string (xdrs
, objp
, ~0))
48 xdr_zotypes (XDR
*xdrs
, zotypes
*objp
)
50 if (!xdr_enum (xdrs
, (enum_t
*) objp
))
56 xdr_nstype (XDR
*xdrs
, nstype
*objp
)
58 if (!xdr_enum (xdrs
, (enum_t
*) objp
))
64 xdr_oar_mask (XDR
*xdrs
, oar_mask
*objp
)
66 if (!xdr_u_int (xdrs
, &objp
->oa_rights
))
68 if (!xdr_zotypes (xdrs
, &objp
->oa_otype
))
74 xdr_endpoint (XDR
*xdrs
, endpoint
*objp
)
76 if (!xdr_string (xdrs
, &objp
->uaddr
, ~0))
78 if (!xdr_string (xdrs
, &objp
->family
, ~0))
80 if (!xdr_string (xdrs
, &objp
->proto
, ~0))
86 _xdr_nis_server (XDR
*xdrs
, nis_server
*objp
)
88 if (!_xdr_nis_name (xdrs
, &objp
->name
))
90 if (!xdr_array (xdrs
, (char **) &objp
->ep
.ep_val
, (u_int
*) &objp
->ep
.ep_len
,
91 ~0, sizeof (endpoint
), (xdrproc_t
) xdr_endpoint
))
93 if (!xdr_u_int (xdrs
, &objp
->key_type
))
95 if (!xdr_netobj (xdrs
, &objp
->pkey
))
101 _xdr_directory_obj (XDR
*xdrs
, directory_obj
*objp
)
103 if (!_xdr_nis_name (xdrs
, &objp
->do_name
))
105 if (!xdr_nstype (xdrs
, &objp
->do_type
))
107 if (!xdr_array (xdrs
, (char **) &objp
->do_servers
.do_servers_val
,
108 (u_int
*) & objp
->do_servers
.do_servers_len
, ~0,
109 sizeof (nis_server
), (xdrproc_t
) _xdr_nis_server
))
112 if (!xdr_uint32_t (xdrs
, &objp
->do_ttl
))
114 if (!xdr_array (xdrs
, (char **) &objp
->do_armask
.do_armask_val
,
115 (u_int
*) & objp
->do_armask
.do_armask_len
, ~0,
116 sizeof (oar_mask
), (xdrproc_t
) xdr_oar_mask
))
122 xdr_entry_col (XDR
*xdrs
, entry_col
*objp
)
124 if (!xdr_u_int (xdrs
, &objp
->ec_flags
))
126 if (!xdr_bytes (xdrs
, (char **) &objp
->ec_value
.ec_value_val
,
127 (u_int
*) &objp
->ec_value
.ec_value_len
, ~0))
133 xdr_entry_obj (XDR
*xdrs
, entry_obj
*objp
)
135 if (!xdr_string (xdrs
, &objp
->en_type
, ~0))
137 if (!xdr_array (xdrs
, (char **) &objp
->en_cols
.en_cols_val
,
138 (u_int
*) &objp
->en_cols
.en_cols_len
, ~0,
139 sizeof (entry_col
), (xdrproc_t
) xdr_entry_col
))
145 xdr_group_obj (XDR
*xdrs
, group_obj
*objp
)
147 if (!xdr_u_int (xdrs
, &objp
->gr_flags
))
149 if (!xdr_array (xdrs
, (char **) &objp
->gr_members
.gr_members_val
,
150 (u_int
*) &objp
->gr_members
.gr_members_len
, ~0,
151 sizeof (nis_name
), (xdrproc_t
) _xdr_nis_name
))
157 xdr_link_obj (XDR
*xdrs
, link_obj
*objp
)
159 if (!xdr_zotypes (xdrs
, &objp
->li_rtype
))
161 if (!xdr_array (xdrs
, (char **) &objp
->li_attrs
.li_attrs_val
,
162 (u_int
*) &objp
->li_attrs
.li_attrs_len
, ~0,
163 sizeof (nis_attr
), (xdrproc_t
) xdr_nis_attr
))
165 if (!_xdr_nis_name (xdrs
, &objp
->li_name
))
171 xdr_table_col (XDR
*xdrs
, table_col
*objp
)
173 if (!xdr_string (xdrs
, &objp
->tc_name
, 64))
175 if (!xdr_u_int (xdrs
, &objp
->tc_flags
))
177 if (!xdr_u_int (xdrs
, &objp
->tc_rights
))
183 xdr_table_obj (XDR
*xdrs
, table_obj
*objp
)
185 if (!xdr_string (xdrs
, &objp
->ta_type
, 64))
187 if (!xdr_int (xdrs
, &objp
->ta_maxcol
))
189 if (!xdr_u_char (xdrs
, &objp
->ta_sep
))
191 if (!xdr_array (xdrs
, (char **) &objp
->ta_cols
.ta_cols_val
,
192 (u_int
*) &objp
->ta_cols
.ta_cols_len
, ~0,
193 sizeof (table_col
), (xdrproc_t
) xdr_table_col
))
195 if (!xdr_string (xdrs
, &objp
->ta_path
, ~0))
201 xdr_objdata (XDR
*xdrs
, objdata
*objp
)
203 if (!xdr_zotypes (xdrs
, &objp
->zo_type
))
205 switch (objp
->zo_type
)
207 case NIS_DIRECTORY_OBJ
:
208 if (!_xdr_directory_obj (xdrs
, &objp
->objdata_u
.di_data
))
212 if (!xdr_group_obj (xdrs
, &objp
->objdata_u
.gr_data
))
216 if (!xdr_table_obj (xdrs
, &objp
->objdata_u
.ta_data
))
220 if (!xdr_entry_obj (xdrs
, &objp
->objdata_u
.en_data
))
224 if (!xdr_link_obj (xdrs
, &objp
->objdata_u
.li_data
))
227 case NIS_PRIVATE_OBJ
:
228 if (!xdr_bytes (xdrs
, (char **) &objp
->objdata_u
.po_data
.po_data_val
,
229 (u_int
*) & objp
->objdata_u
.po_data
.po_data_len
, ~0))
243 xdr_nis_oid (XDR
*xdrs
, nis_oid
*objp
)
245 if (!xdr_uint32_t (xdrs
, &objp
->ctime
))
247 if (!xdr_uint32_t (xdrs
, &objp
->mtime
))
253 _xdr_nis_object (XDR
*xdrs
, nis_object
*objp
)
255 if (!xdr_nis_oid (xdrs
, &objp
->zo_oid
))
257 if (!_xdr_nis_name (xdrs
, &objp
->zo_name
))
259 if (!_xdr_nis_name (xdrs
, &objp
->zo_owner
))
261 if (!_xdr_nis_name (xdrs
, &objp
->zo_group
))
263 if (!_xdr_nis_name (xdrs
, &objp
->zo_domain
))
265 if (!xdr_u_int (xdrs
, &objp
->zo_access
))
267 if (!xdr_uint32_t (xdrs
, &objp
->zo_ttl
))
269 if (!xdr_objdata (xdrs
, &objp
->zo_data
))
275 _xdr_nis_error (XDR
*xdrs
, nis_error
*objp
)
277 if (!xdr_enum (xdrs
, (enum_t
*) objp
))
283 _xdr_nis_result (XDR
*xdrs
, nis_result
*objp
)
285 if (!_xdr_nis_error (xdrs
, &objp
->status
))
287 if (!xdr_array (xdrs
, (char **) &objp
->objects
.objects_val
,
288 (u_int
*) &objp
->objects
.objects_len
, ~0,
289 sizeof (nis_object
), (xdrproc_t
) _xdr_nis_object
))
291 if (!xdr_netobj (xdrs
, &objp
->cookie
))
293 if (!xdr_uint32_t (xdrs
, &objp
->zticks
))
295 if (!xdr_uint32_t (xdrs
, &objp
->dticks
))
297 if (!xdr_uint32_t (xdrs
, &objp
->aticks
))
299 if (!xdr_uint32_t (xdrs
, &objp
->cticks
))
305 _xdr_ns_request (XDR
*xdrs
, ns_request
*objp
)
307 if (!_xdr_nis_name (xdrs
, &objp
->ns_name
))
309 if (!xdr_array (xdrs
, (char **) &objp
->ns_object
.ns_object_val
,
310 (u_int
*) &objp
->ns_object
.ns_object_len
, 1,
311 sizeof (nis_object
), (xdrproc_t
) _xdr_nis_object
))
317 _xdr_ib_request (XDR
*xdrs
, ib_request
*objp
)
319 if (!_xdr_nis_name (xdrs
, &objp
->ibr_name
))
321 if (!xdr_array (xdrs
, (char **) &objp
->ibr_srch
.ibr_srch_val
,
322 (u_int
*) &objp
->ibr_srch
.ibr_srch_len
, ~0,
323 sizeof (nis_attr
), (xdrproc_t
) xdr_nis_attr
))
325 if (!xdr_u_int (xdrs
, &objp
->ibr_flags
))
327 if (!xdr_array (xdrs
, (char **) &objp
->ibr_obj
.ibr_obj_val
,
328 (u_int
*) &objp
->ibr_obj
.ibr_obj_len
, 1,
329 sizeof (nis_object
), (xdrproc_t
) _xdr_nis_object
))
331 if (!xdr_array (xdrs
, (char **) &objp
->ibr_cbhost
.ibr_cbhost_val
,
332 (u_int
*) &objp
->ibr_cbhost
.ibr_cbhost_len
, 1,
333 sizeof (nis_server
), (xdrproc_t
) _xdr_nis_server
))
335 if (!xdr_u_int (xdrs
, &objp
->ibr_bufsize
))
337 if (!xdr_netobj (xdrs
, &objp
->ibr_cookie
))
343 _xdr_ping_args (XDR
*xdrs
, ping_args
*objp
)
345 if (!_xdr_nis_name (xdrs
, &objp
->dir
))
347 if (!xdr_uint32_t (xdrs
, &objp
->stamp
))
353 _xdr_cp_result (XDR
*xdrs
, cp_result
*objp
)
355 if (!_xdr_nis_error (xdrs
, &objp
->cp_status
))
357 if (!xdr_uint32_t (xdrs
, &objp
->cp_zticks
))
359 if (!xdr_uint32_t (xdrs
, &objp
->cp_dticks
))
365 _xdr_nis_tag (XDR
*xdrs
, nis_tag
*objp
)
367 if (!xdr_u_int (xdrs
, &objp
->tag_type
))
369 if (!xdr_string (xdrs
, &objp
->tag_val
, ~0))
375 _xdr_nis_taglist (XDR
*xdrs
, nis_taglist
*objp
)
377 if (!xdr_array (xdrs
, (char **) &objp
->tags
.tags_val
,
378 (u_int
*) &objp
->tags
.tags_len
, ~0, sizeof (nis_tag
),
379 (xdrproc_t
) _xdr_nis_tag
))
385 _xdr_fd_args (XDR
*xdrs
, fd_args
*objp
)
387 if (!_xdr_nis_name (xdrs
, &objp
->dir_name
))
389 if (!_xdr_nis_name (xdrs
, &objp
->requester
))
395 _xdr_fd_result (XDR
*xdrs
, fd_result
*objp
)
397 if (!_xdr_nis_error (xdrs
, &objp
->status
))
399 if (!_xdr_nis_name (xdrs
, &objp
->source
))
401 if (!xdr_bytes (xdrs
, (char **) &objp
->dir_data
.dir_data_val
,
402 (u_int
*) &objp
->dir_data
.dir_data_len
, ~0))
404 if (!xdr_bytes (xdrs
, (char **) &objp
->signature
.signature_val
,
405 (u_int
*) &objp
->signature
.signature_len
, ~0))
410 /* The following functions have prototypes in nis_callback.h. So
411 we make them public */
413 xdr_obj_p (XDR
*xdrs
, obj_p
*objp
)
415 if (!xdr_pointer (xdrs
, (char **)objp
, sizeof (nis_object
),
416 (xdrproc_t
)_xdr_nis_object
))
422 xdr_cback_data (XDR
*xdrs
, cback_data
*objp
)
424 if (!xdr_array (xdrs
, (char **)&objp
->entries
.entries_val
,
425 (u_int
*) &objp
->entries
.entries_len
, ~0,
426 sizeof (obj_p
), (xdrproc_t
) xdr_obj_p
))