xref: /titanic_41/usr/src/lib/libnsl/nis/gen/nis_xdr.c (revision 1402f64f9efa57c2c2cba776f3f45c67e6055deb)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * Originally generated using rpcgen.
29  */
30 
31 #include "mt.h"
32 #include <rpc/rpc.h>
33 #include <rpcsvc/nis.h>
34 
35 bool_t
36 xdr_nis_attr(XDR *xdrs, nis_attr *objp)
37 {
38 	if (!xdr_string(xdrs, &objp->zattr_ndx, ~0))
39 		return (FALSE);
40 	return (xdr_bytes(xdrs, (char **)&objp->zattr_val.zattr_val_val,
41 	    (uint_t *)&objp->zattr_val.zattr_val_len, ~0));
42 }
43 
44 bool_t
45 xdr_nis_name(XDR *xdrs, nis_name *objp)
46 {
47 	return (xdr_string(xdrs, objp, ~0));
48 }
49 
50 bool_t
51 xdr_zotypes(XDR *xdrs, zotypes *objp)
52 {
53 	return (xdr_enum(xdrs, (enum_t *)objp));
54 }
55 
56 bool_t
57 xdr_nstype(XDR *xdrs, nstype *objp)
58 {
59 	return (xdr_enum(xdrs, (enum_t *)objp));
60 }
61 
62 bool_t
63 xdr_oar_mask(XDR *xdrs, oar_mask *objp)
64 {
65 	if (!xdr_u_int(xdrs, &objp->oa_rights))
66 		return (FALSE);
67 	return (xdr_zotypes(xdrs, &objp->oa_otype));
68 }
69 
70 bool_t
71 xdr_endpoint(XDR *xdrs, endpoint *objp)
72 {
73 	if (!xdr_string(xdrs, &objp->uaddr, ~0))
74 		return (FALSE);
75 	if (!xdr_string(xdrs, &objp->family, ~0))
76 		return (FALSE);
77 	return (xdr_string(xdrs, &objp->proto, ~0));
78 }
79 
80 bool_t
81 xdr_nis_server(XDR *xdrs, nis_server *objp)
82 {
83 	if (!xdr_nis_name(xdrs, &objp->name))
84 		return (FALSE);
85 	if (!xdr_array(xdrs, (char **)&objp->ep.ep_val,
86 	    (uint_t *)&objp->ep.ep_len, ~0,
87 	    sizeof (endpoint), (xdrproc_t)xdr_endpoint))
88 		return (FALSE);
89 	if (!xdr_u_int(xdrs, &objp->key_type))
90 		return (FALSE);
91 	return (xdr_netobj(xdrs, &objp->pkey));
92 }
93 
94 bool_t
95 xdr_directory_obj(XDR *xdrs, directory_obj *objp)
96 {
97 	if (!xdr_nis_name(xdrs, &objp->do_name))
98 		return (FALSE);
99 	if (!xdr_nstype(xdrs, &objp->do_type))
100 		return (FALSE);
101 	if (!xdr_array(xdrs, (char **)&objp->do_servers.do_servers_val,
102 	    (uint_t *)&objp->do_servers.do_servers_len, ~0,
103 	    sizeof (nis_server), (xdrproc_t)xdr_nis_server))
104 		return (FALSE);
105 	if (!xdr_uint32_t(xdrs, &objp->do_ttl))
106 		return (FALSE);
107 	return (xdr_array(xdrs, (char **)&objp->do_armask.do_armask_val,
108 	    (uint_t *)&objp->do_armask.do_armask_len, ~0,
109 	    sizeof (oar_mask), (xdrproc_t)xdr_oar_mask));
110 }
111 
112 bool_t
113 xdr_entry_col(XDR *xdrs, entry_col *objp)
114 {
115 	if (!xdr_u_int(xdrs, &objp->ec_flags))
116 		return (FALSE);
117 	return (xdr_bytes(xdrs, (char **)&objp->ec_value.ec_value_val,
118 	    (uint_t *)&objp->ec_value.ec_value_len, ~0));
119 }
120 
121 bool_t
122 xdr_entry_obj(XDR *xdrs, entry_obj *objp)
123 {
124 	if (!xdr_string(xdrs, &objp->en_type, ~0))
125 		return (FALSE);
126 	return (xdr_array(xdrs, (char **)&objp->en_cols.en_cols_val,
127 	    (uint_t *)&objp->en_cols.en_cols_len, ~0,
128 	    sizeof (entry_col), (xdrproc_t)xdr_entry_col));
129 }
130 
131 bool_t
132 xdr_group_obj(XDR *xdrs, group_obj *objp)
133 {
134 	if (!xdr_u_int(xdrs, &objp->gr_flags))
135 		return (FALSE);
136 	return (xdr_array(xdrs, (char **)&objp->gr_members.gr_members_val,
137 	    (uint_t *)&objp->gr_members.gr_members_len, ~0,
138 	    sizeof (nis_name), (xdrproc_t)xdr_nis_name));
139 }
140 
141 bool_t
142 xdr_link_obj(XDR *xdrs, link_obj *objp)
143 {
144 	if (!xdr_zotypes(xdrs, &objp->li_rtype))
145 		return (FALSE);
146 	if (!xdr_array(xdrs, (char **)&objp->li_attrs.li_attrs_val,
147 	    (uint_t *)&objp->li_attrs.li_attrs_len, ~0,
148 	    sizeof (nis_attr), (xdrproc_t)xdr_nis_attr))
149 		return (FALSE);
150 	return (xdr_nis_name(xdrs, &objp->li_name));
151 }
152 
153 bool_t
154 xdr_table_col(XDR *xdrs, table_col *objp)
155 {
156 	if (!xdr_string(xdrs, &objp->tc_name, 64))
157 		return (FALSE);
158 	if (!xdr_u_int(xdrs, &objp->tc_flags))
159 		return (FALSE);
160 	return (xdr_u_int(xdrs, &objp->tc_rights));
161 }
162 
163 bool_t
164 xdr_table_obj(XDR *xdrs, table_obj *objp)
165 {
166 	if (!xdr_string(xdrs, &objp->ta_type, 64))
167 		return (FALSE);
168 	if (!xdr_int(xdrs, &objp->ta_maxcol))
169 		return (FALSE);
170 	if (!xdr_u_char(xdrs, &objp->ta_sep))
171 		return (FALSE);
172 	if (!xdr_array(xdrs, (char **)&objp->ta_cols.ta_cols_val,
173 	    (uint_t *)&objp->ta_cols.ta_cols_len, ~0,
174 	    sizeof (table_col), (xdrproc_t)xdr_table_col))
175 		return (FALSE);
176 	return (xdr_string(xdrs, &objp->ta_path, ~0));
177 }
178 
179 bool_t
180 xdr_objdata(XDR *xdrs, objdata *objp)
181 {
182 	if (!xdr_zotypes(xdrs, &objp->zo_type))
183 		return (FALSE);
184 
185 	switch (objp->zo_type) {
186 	case NIS_DIRECTORY_OBJ:
187 		return (xdr_directory_obj(xdrs, &objp->objdata_u.di_data));
188 	case NIS_GROUP_OBJ:
189 		return (xdr_group_obj(xdrs, &objp->objdata_u.gr_data));
190 	case NIS_TABLE_OBJ:
191 		return (xdr_table_obj(xdrs, &objp->objdata_u.ta_data));
192 	case NIS_ENTRY_OBJ:
193 		return (xdr_entry_obj(xdrs, &objp->objdata_u.en_data));
194 	case NIS_LINK_OBJ:
195 		return (xdr_link_obj(xdrs, &objp->objdata_u.li_data));
196 	case NIS_PRIVATE_OBJ:
197 		return (xdr_bytes(xdrs,
198 		    (char **)&objp->objdata_u.po_data.po_data_val,
199 		    (uint_t *)&objp->objdata_u.po_data.po_data_len, ~0));
200 	case NIS_NO_OBJ:
201 		return (TRUE);
202 	case NIS_BOGUS_OBJ:
203 		return (TRUE);
204 	}
205 	return (TRUE);
206 }
207 
208 bool_t
209 xdr_nis_oid(XDR *xdrs, nis_oid *objp)
210 {
211 	if (!xdr_uint32_t(xdrs, &objp->ctime))
212 		return (FALSE);
213 	return (xdr_uint32_t(xdrs, &objp->mtime));
214 }
215 
216 bool_t
217 xdr_nis_object(XDR *xdrs, nis_object *objp)
218 {
219 	if (!xdr_nis_oid(xdrs, &objp->zo_oid))
220 		return (FALSE);
221 	if (!xdr_nis_name(xdrs, &objp->zo_name))
222 		return (FALSE);
223 	if (!xdr_nis_name(xdrs, &objp->zo_owner))
224 		return (FALSE);
225 	if (!xdr_nis_name(xdrs, &objp->zo_group))
226 		return (FALSE);
227 	if (!xdr_nis_name(xdrs, &objp->zo_domain))
228 		return (FALSE);
229 	if (!xdr_u_int(xdrs, &objp->zo_access))
230 		return (FALSE);
231 	if (!xdr_uint32_t(xdrs, &objp->zo_ttl))
232 		return (FALSE);
233 	return (xdr_objdata(xdrs, &objp->zo_data));
234 }
235