xref: /freebsd/lib/libc/rpc/key_prot_xdr.c (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
1 /*
2  * Please do not edit this file.
3  * It was generated using rpcgen.
4  */
5 
6 #include "namespace.h"
7 #include <rpc/key_prot.h>
8 #include "un-namespace.h"
9 /*
10  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
11  * unrestricted use provided that this legend is included on all tape
12  * media and as a part of the software program in whole or part.  Users
13  * may copy or modify Sun RPC without charge, but are not authorized
14  * to license or distribute it to anyone else except as part of a product or
15  * program developed by the user.
16  *
17  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
18  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
20  *
21  * Sun RPC is provided with no support and without any obligation on the
22  * part of Sun Microsystems, Inc. to assist in its use, correction,
23  * modification or enhancement.
24  *
25  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
26  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
27  * OR ANY PART THEREOF.
28  *
29  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
30  * or profits or other special, indirect and consequential damages, even if
31  * Sun has been advised of the possibility of such damages.
32  *
33  * Sun Microsystems, Inc.
34  * 2550 Garcia Avenue
35  * Mountain View, California  94043
36  */
37 /* Copyright (c)  1990, 1991 Sun Microsystems, Inc. */
38 
39 /* #pragma ident	"@(#)key_prot.x	1.7	94/04/29 SMI" */
40 #include <sys/cdefs.h>
41 __FBSDID("$FreeBSD$");
42 
43 /*
44  * Compiled from key_prot.x using rpcgen.
45  * DO NOT EDIT THIS FILE!
46  * This is NOT source code!
47  */
48 
49 bool_t
50 xdr_keystatus(register XDR *xdrs, keystatus *objp)
51 {
52 
53 	if (!xdr_enum(xdrs, (enum_t *)objp))
54 		return (FALSE);
55 	return (TRUE);
56 }
57 
58 bool_t
59 xdr_keybuf(register XDR *xdrs, keybuf objp)
60 {
61 
62 	if (!xdr_opaque(xdrs, objp, HEXKEYBYTES))
63 		return (FALSE);
64 	return (TRUE);
65 }
66 
67 bool_t
68 xdr_netnamestr(register XDR *xdrs, netnamestr *objp)
69 {
70 
71 	if (!xdr_string(xdrs, objp, MAXNETNAMELEN))
72 		return (FALSE);
73 	return (TRUE);
74 }
75 
76 bool_t
77 xdr_cryptkeyarg(register XDR *xdrs, cryptkeyarg *objp)
78 {
79 
80 	if (!xdr_netnamestr(xdrs, &objp->remotename))
81 		return (FALSE);
82 	if (!xdr_des_block(xdrs, &objp->deskey))
83 		return (FALSE);
84 	return (TRUE);
85 }
86 
87 bool_t
88 xdr_cryptkeyarg2(register XDR *xdrs, cryptkeyarg2 *objp)
89 {
90 
91 	if (!xdr_netnamestr(xdrs, &objp->remotename))
92 		return (FALSE);
93 	if (!xdr_netobj(xdrs, &objp->remotekey))
94 		return (FALSE);
95 	if (!xdr_des_block(xdrs, &objp->deskey))
96 		return (FALSE);
97 	return (TRUE);
98 }
99 
100 bool_t
101 xdr_cryptkeyres(register XDR *xdrs, cryptkeyres *objp)
102 {
103 
104 	if (!xdr_keystatus(xdrs, &objp->status))
105 		return (FALSE);
106 	switch (objp->status) {
107 	case KEY_SUCCESS:
108 		if (!xdr_des_block(xdrs, &objp->cryptkeyres_u.deskey))
109 			return (FALSE);
110 		break;
111 	default:
112 		break;
113 	}
114 	return (TRUE);
115 }
116 
117 bool_t
118 xdr_unixcred(register XDR *xdrs, unixcred *objp)
119 {
120 	u_int **pgids_val;
121 
122 	if (!xdr_u_int(xdrs, &objp->uid))
123 		return (FALSE);
124 	if (!xdr_u_int(xdrs, &objp->gid))
125 		return (FALSE);
126 	pgids_val = &objp->gids.gids_val;
127 	if (!xdr_array(xdrs, (char **) pgids_val, (u_int *) &objp->gids.gids_len, MAXGIDS,
128 		sizeof (u_int), (xdrproc_t) xdr_u_int))
129 		return (FALSE);
130 	return (TRUE);
131 }
132 
133 bool_t
134 xdr_getcredres(register XDR *xdrs, getcredres *objp)
135 {
136 
137 	if (!xdr_keystatus(xdrs, &objp->status))
138 		return (FALSE);
139 	switch (objp->status) {
140 	case KEY_SUCCESS:
141 		if (!xdr_unixcred(xdrs, &objp->getcredres_u.cred))
142 			return (FALSE);
143 		break;
144 	default:
145 		break;
146 	}
147 	return (TRUE);
148 }
149 
150 bool_t
151 xdr_key_netstarg(register XDR *xdrs, key_netstarg *objp)
152 {
153 
154 	if (!xdr_keybuf(xdrs, objp->st_priv_key))
155 		return (FALSE);
156 	if (!xdr_keybuf(xdrs, objp->st_pub_key))
157 		return (FALSE);
158 	if (!xdr_netnamestr(xdrs, &objp->st_netname))
159 		return (FALSE);
160 	return (TRUE);
161 }
162 
163 bool_t
164 xdr_key_netstres(register XDR *xdrs, key_netstres *objp)
165 {
166 
167 	if (!xdr_keystatus(xdrs, &objp->status))
168 		return (FALSE);
169 	switch (objp->status) {
170 	case KEY_SUCCESS:
171 		if (!xdr_key_netstarg(xdrs, &objp->key_netstres_u.knet))
172 			return (FALSE);
173 		break;
174 	default:
175 		break;
176 	}
177 	return (TRUE);
178 }
179