xref: /freebsd/lib/libc/rpc/key_prot_xdr.c (revision 42c159fe388a3765f69860c84183700af37aca8a)
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 /* From: #pragma ident	"@(#)key_prot.x	1.7	94/04/29 SMI" */
38 /* Copyright (c)  1990, 1991 Sun Microsystems, Inc. */
39 
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 
121 	if (!xdr_u_int(xdrs, &objp->uid))
122 		return (FALSE);
123 	if (!xdr_u_int(xdrs, &objp->gid))
124 		return (FALSE);
125 	if (!xdr_array(xdrs, (char **)&objp->gids.gids_val, (u_int *) &objp->gids.gids_len, MAXGIDS,
126 		sizeof (u_int), (xdrproc_t) xdr_u_int))
127 		return (FALSE);
128 	return (TRUE);
129 }
130 
131 bool_t
132 xdr_getcredres(register XDR *xdrs, getcredres *objp)
133 {
134 
135 	if (!xdr_keystatus(xdrs, &objp->status))
136 		return (FALSE);
137 	switch (objp->status) {
138 	case KEY_SUCCESS:
139 		if (!xdr_unixcred(xdrs, &objp->getcredres_u.cred))
140 			return (FALSE);
141 		break;
142 	default:
143 		break;
144 	}
145 	return (TRUE);
146 }
147 
148 bool_t
149 xdr_key_netstarg(register XDR *xdrs, key_netstarg *objp)
150 {
151 
152 	if (!xdr_keybuf(xdrs, objp->st_priv_key))
153 		return (FALSE);
154 	if (!xdr_keybuf(xdrs, objp->st_pub_key))
155 		return (FALSE);
156 	if (!xdr_netnamestr(xdrs, &objp->st_netname))
157 		return (FALSE);
158 	return (TRUE);
159 }
160 
161 bool_t
162 xdr_key_netstres(register XDR *xdrs, key_netstres *objp)
163 {
164 
165 	if (!xdr_keystatus(xdrs, &objp->status))
166 		return (FALSE);
167 	switch (objp->status) {
168 	case KEY_SUCCESS:
169 		if (!xdr_key_netstarg(xdrs, &objp->key_netstres_u.knet))
170 			return (FALSE);
171 		break;
172 	default:
173 		break;
174 	}
175 	return (TRUE);
176 }
177