Move variable declarations from header to source
[platform/upstream/libtirpc.git] / src / key_prot_xdr.c
1 /*
2  * Please do not edit this file.
3  * It was generated using rpcgen.
4  */
5
6 #include <rpc/key_prot.h>
7 /*
8  * Copyright (c) 2009, Sun Microsystems, Inc.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  * - Redistributions of source code must retain the above copyright notice,
14  *   this list of conditions and the following disclaimer.
15  * - Redistributions in binary form must reproduce the above copyright notice,
16  *   this list of conditions and the following disclaimer in the documentation
17  *   and/or other materials provided with the distribution.
18  * - Neither the name of Sun Microsystems, Inc. nor the names of its
19  *   contributors may be used to endorse or promote products derived
20  *   from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 /* Copyright (c)  1990, 1991 Sun Microsystems, Inc. */
35
36 #include <sys/cdefs.h>
37
38 /* 
39  * Compiled from key_prot.x using rpcgen.
40  * DO NOT EDIT THIS FILE!
41  * This is NOT source code!
42  */
43
44 bool_t
45 xdr_keystatus(register XDR *xdrs, keystatus *objp)
46 {
47
48         if (!xdr_enum(xdrs, (enum_t *)objp))
49                 return (FALSE);
50         return (TRUE);
51 }
52
53 bool_t
54 xdr_keybuf(register XDR *xdrs, keybuf objp)
55 {
56
57         if (!xdr_opaque(xdrs, objp, HEXKEYBYTES))
58                 return (FALSE);
59         return (TRUE);
60 }
61
62 bool_t
63 xdr_netnamestr(register XDR *xdrs, netnamestr *objp)
64 {
65
66         if (!xdr_string(xdrs, objp, MAXNETNAMELEN))
67                 return (FALSE);
68         return (TRUE);
69 }
70
71 bool_t
72 xdr_cryptkeyarg(register XDR *xdrs, cryptkeyarg *objp)
73 {
74
75         if (!xdr_netnamestr(xdrs, &objp->remotename))
76                 return (FALSE);
77         if (!xdr_des_block(xdrs, &objp->deskey))
78                 return (FALSE);
79         return (TRUE);
80 }
81
82 bool_t
83 xdr_cryptkeyarg2(register XDR *xdrs, cryptkeyarg2 *objp)
84 {
85
86         if (!xdr_netnamestr(xdrs, &objp->remotename))
87                 return (FALSE);
88         if (!xdr_netobj(xdrs, &objp->remotekey))
89                 return (FALSE);
90         if (!xdr_des_block(xdrs, &objp->deskey))
91                 return (FALSE);
92         return (TRUE);
93 }
94
95 bool_t
96 xdr_cryptkeyres(register XDR *xdrs, cryptkeyres *objp)
97 {
98
99         if (!xdr_keystatus(xdrs, &objp->status))
100                 return (FALSE);
101         switch (objp->status) {
102         case KEY_SUCCESS:
103                 if (!xdr_des_block(xdrs, &objp->cryptkeyres_u.deskey))
104                         return (FALSE);
105                 break;
106         default:
107                 break;
108         }
109         return (TRUE);
110 }
111
112 bool_t
113 xdr_unixcred(register XDR *xdrs, unixcred *objp)
114 {
115
116         if (!xdr_u_int(xdrs, &objp->uid))
117                 return (FALSE);
118         if (!xdr_u_int(xdrs, &objp->gid))
119                 return (FALSE);
120         if (!xdr_array(xdrs, (char **)&objp->gids.gids_val, (u_int *) &objp->gids.gids_len, MAXGIDS,
121                 sizeof (u_int), (xdrproc_t) xdr_u_int))
122                 return (FALSE);
123         return (TRUE);
124 }
125
126 bool_t
127 xdr_getcredres(register XDR *xdrs, getcredres *objp)
128 {
129
130         if (!xdr_keystatus(xdrs, &objp->status))
131                 return (FALSE);
132         switch (objp->status) {
133         case KEY_SUCCESS:
134                 if (!xdr_unixcred(xdrs, &objp->getcredres_u.cred))
135                         return (FALSE);
136                 break;
137         default:
138                 break;
139         }
140         return (TRUE);
141 }
142
143 bool_t
144 xdr_key_netstarg(register XDR *xdrs, key_netstarg *objp)
145 {
146
147         if (!xdr_keybuf(xdrs, objp->st_priv_key))
148                 return (FALSE);
149         if (!xdr_keybuf(xdrs, objp->st_pub_key))
150                 return (FALSE);
151         if (!xdr_netnamestr(xdrs, &objp->st_netname))
152                 return (FALSE);
153         return (TRUE);
154 }
155
156 bool_t
157 xdr_key_netstres(register XDR *xdrs, key_netstres *objp)
158 {
159
160         if (!xdr_keystatus(xdrs, &objp->status))
161                 return (FALSE);
162         switch (objp->status) {
163         case KEY_SUCCESS:
164                 if (!xdr_key_netstarg(xdrs, &objp->key_netstres_u.knet))
165                         return (FALSE);
166                 break;
167         default:
168                 break;
169         }
170         return (TRUE);
171 }