Update copyright dates with scripts/update-copyrights.
[glibc.git] / nis / rpcsvc / yp.h
blob968b74c42e6532f8c38dd1ed629747435bd4bd16
1 /*
2 * Copyright (c) 2010, Oracle America, Inc.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following
12 * disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 * * Neither the name of the "Oracle America, Inc." nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef __RPCSVC_YP_H__
33 #define __RPCSVC_YP_H__
35 #include <features.h>
36 #include <rpc/rpc.h>
38 #define YPMAXRECORD 1024
39 #define YPMAXDOMAIN 64
40 #define YPMAXMAP 64
41 #define YPMAXPEER 64
43 enum ypstat {
44 YP_TRUE = 1,
45 YP_NOMORE = 2,
46 YP_FALSE = 0,
47 YP_NOMAP = -1,
48 YP_NODOM = -2,
49 YP_NOKEY = -3,
50 YP_BADOP = -4,
51 YP_BADDB = -5,
52 YP_YPERR = -6,
53 YP_BADARGS = -7,
54 YP_VERS = -8,
56 typedef enum ypstat ypstat;
58 enum ypxfrstat {
59 YPXFR_SUCC = 1,
60 YPXFR_AGE = 2,
61 YPXFR_NOMAP = -1,
62 YPXFR_NODOM = -2,
63 YPXFR_RSRC = -3,
64 YPXFR_RPC = -4,
65 YPXFR_MADDR = -5,
66 YPXFR_YPERR = -6,
67 YPXFR_BADARGS = -7,
68 YPXFR_DBM = -8,
69 YPXFR_FILE = -9,
70 YPXFR_SKEW = -10,
71 YPXFR_CLEAR = -11,
72 YPXFR_FORCE = -12,
73 YPXFR_XFRERR = -13,
74 YPXFR_REFUSED = -14,
76 typedef enum ypxfrstat ypxfrstat;
78 typedef char *domainname;
79 typedef char *mapname;
80 typedef char *peername;
82 typedef struct {
83 u_int keydat_len;
84 char *keydat_val;
85 } keydat;
87 typedef struct {
88 u_int valdat_len;
89 char *valdat_val;
90 } valdat;
92 struct ypmap_parms {
93 domainname domain;
94 mapname map;
95 u_int ordernum;
96 peername peer;
98 typedef struct ypmap_parms ypmap_parms;
100 struct ypreq_key {
101 domainname domain;
102 mapname map;
103 keydat key;
105 typedef struct ypreq_key ypreq_key;
107 struct ypreq_nokey {
108 domainname domain;
109 mapname map;
111 typedef struct ypreq_nokey ypreq_nokey;
113 struct ypreq_xfr {
114 ypmap_parms map_parms;
115 u_int transid;
116 u_int prog;
117 u_int port;
119 typedef struct ypreq_xfr ypreq_xfr;
121 struct ypresp_val {
122 ypstat stat;
123 valdat val;
125 typedef struct ypresp_val ypresp_val;
127 struct ypresp_key_val {
128 ypstat stat;
129 #ifdef STUPID_SUN_BUG
130 /* This is the form as distributed by Sun. But even the Sun NIS
131 servers expect the values in the other order. So their
132 implementation somehow must change the order internally. We
133 don't want to follow this bad example since the user should be
134 able to use rpcgen on this file. */
135 keydat key;
136 valdat val;
137 #else
138 valdat val;
139 keydat key;
140 #endif
142 typedef struct ypresp_key_val ypresp_key_val;
144 struct ypresp_master {
145 ypstat stat;
146 peername peer;
148 typedef struct ypresp_master ypresp_master;
150 struct ypresp_order {
151 ypstat stat;
152 u_int ordernum;
154 typedef struct ypresp_order ypresp_order;
156 struct ypresp_all {
157 bool_t more;
158 union {
159 ypresp_key_val val;
160 } ypresp_all_u;
162 typedef struct ypresp_all ypresp_all;
164 struct ypresp_xfr {
165 u_int transid;
166 ypxfrstat xfrstat;
168 typedef struct ypresp_xfr ypresp_xfr;
170 struct ypmaplist {
171 mapname map;
172 struct ypmaplist *next;
174 typedef struct ypmaplist ypmaplist;
176 struct ypresp_maplist {
177 ypstat stat;
178 ypmaplist *maps;
180 typedef struct ypresp_maplist ypresp_maplist;
182 enum yppush_status {
183 YPPUSH_SUCC = 1,
184 YPPUSH_AGE = 2,
185 YPPUSH_NOMAP = -1,
186 YPPUSH_NODOM = -2,
187 YPPUSH_RSRC = -3,
188 YPPUSH_RPC = -4,
189 YPPUSH_MADDR = -5,
190 YPPUSH_YPERR = -6,
191 YPPUSH_BADARGS = -7,
192 YPPUSH_DBM = -8,
193 YPPUSH_FILE = -9,
194 YPPUSH_SKEW = -10,
195 YPPUSH_CLEAR = -11,
196 YPPUSH_FORCE = -12,
197 YPPUSH_XFRERR = -13,
198 YPPUSH_REFUSED = -14,
200 typedef enum yppush_status yppush_status;
202 struct yppushresp_xfr {
203 u_int transid;
204 yppush_status status;
206 typedef struct yppushresp_xfr yppushresp_xfr;
208 enum ypbind_resptype {
209 YPBIND_SUCC_VAL = 1,
210 YPBIND_FAIL_VAL = 2,
212 typedef enum ypbind_resptype ypbind_resptype;
214 struct ypbind_binding {
215 char ypbind_binding_addr[4];
216 char ypbind_binding_port[2];
218 typedef struct ypbind_binding ypbind_binding;
220 struct ypbind_resp {
221 ypbind_resptype ypbind_status;
222 union {
223 u_int ypbind_error;
224 ypbind_binding ypbind_bindinfo;
225 } ypbind_resp_u;
227 typedef struct ypbind_resp ypbind_resp;
229 #define YPBIND_ERR_ERR 1
230 #define YPBIND_ERR_NOSERV 2
231 #define YPBIND_ERR_RESC 3
233 struct ypbind_setdom {
234 domainname ypsetdom_domain;
235 ypbind_binding ypsetdom_binding;
236 u_int ypsetdom_vers;
238 typedef struct ypbind_setdom ypbind_setdom;
240 __BEGIN_DECLS
242 #define YPPROG 100004
243 #define YPVERS 2
245 #define YPPROC_NULL 0
246 extern void *ypproc_null_2 (void *, CLIENT *);
247 extern void *ypproc_null_2_svc (void *, struct svc_req *);
248 #define YPPROC_DOMAIN 1
249 extern bool_t *ypproc_domain_2 (domainname *, CLIENT *);
250 extern bool_t *ypproc_domain_2_svc (domainname *, struct svc_req *);
251 #define YPPROC_DOMAIN_NONACK 2
252 extern bool_t *ypproc_domain_nonack_2 (domainname *, CLIENT *);
253 extern bool_t *ypproc_domain_nonack_2_svc (domainname *, struct svc_req *);
254 #define YPPROC_MATCH 3
255 extern ypresp_val *ypproc_match_2 (ypreq_key *, CLIENT *);
256 extern ypresp_val *ypproc_match_2_svc (ypreq_key *, struct svc_req *);
257 #define YPPROC_FIRST 4
258 extern ypresp_key_val *ypproc_first_2 (ypreq_key *, CLIENT *);
259 extern ypresp_key_val *ypproc_first_2_svc (ypreq_key *, struct svc_req *);
260 #define YPPROC_NEXT 5
261 extern ypresp_key_val *ypproc_next_2 (ypreq_key *, CLIENT *);
262 extern ypresp_key_val *ypproc_next_2_svc (ypreq_key *, struct svc_req *);
263 #define YPPROC_XFR 6
264 extern ypresp_xfr *ypproc_xfr_2 (ypreq_xfr *, CLIENT *);
265 extern ypresp_xfr *ypproc_xfr_2_svc (ypreq_xfr *, struct svc_req *);
266 #define YPPROC_CLEAR 7
267 extern void *ypproc_clear_2 (void *, CLIENT *);
268 extern void *ypproc_clear_2_svc (void *, struct svc_req *);
269 #define YPPROC_ALL 8
270 extern ypresp_all *ypproc_all_2 (ypreq_nokey *, CLIENT *);
271 extern ypresp_all *ypproc_all_2_svc (ypreq_nokey *, struct svc_req *);
272 #define YPPROC_MASTER 9
273 extern ypresp_master *ypproc_master_2 (ypreq_nokey *, CLIENT *);
274 extern ypresp_master *ypproc_master_2_svc (ypreq_nokey *, struct svc_req *);
275 #define YPPROC_ORDER 10
276 extern ypresp_order *ypproc_order_2 (ypreq_nokey *, CLIENT *);
277 extern ypresp_order *ypproc_order_2_svc (ypreq_nokey *, struct svc_req *);
278 #define YPPROC_MAPLIST 11
279 extern ypresp_maplist *ypproc_maplist_2 (domainname *, CLIENT *);
280 extern ypresp_maplist *ypproc_maplist_2_svc (domainname *, struct svc_req *);
281 extern int ypprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
284 #define YPPUSH_XFRRESPPROG (0x40000000)
285 #define YPPUSH_XFRRESPVERS 1
287 #define YPPUSHPROC_NULL 0
288 extern void *yppushproc_null_1 (void *, CLIENT *);
289 extern void *yppushproc_null_1_svc (void *, struct svc_req *);
290 #define YPPUSHPROC_XFRRESP 1
291 extern void *yppushproc_xfrresp_1 (yppushresp_xfr *, CLIENT *);
292 extern void *yppushproc_xfrresp_1_svc (yppushresp_xfr *, struct svc_req *);
293 extern int yppush_xfrrespprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
296 #define YPBINDPROG 100007
297 #define YPBINDVERS 2
299 #define YPBINDPROC_NULL 0
300 extern void *ypbindproc_null_2 (void *, CLIENT *);
301 extern void *ypbindproc_null_2_svc (void *, struct svc_req *);
302 #define YPBINDPROC_DOMAIN 1
303 extern ypbind_resp *ypbindproc_domain_2 (domainname *, CLIENT *);
304 extern ypbind_resp *ypbindproc_domain_2_svc (domainname *, struct svc_req *);
305 #define YPBINDPROC_SETDOM 2
306 extern void *ypbindproc_setdom_2 (ypbind_setdom *, CLIENT *);
307 extern void *ypbindproc_setdom_2_svc (ypbind_setdom *, struct svc_req *);
308 extern int ypbindprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
311 extern bool_t xdr_ypstat (XDR *, ypstat*);
312 extern bool_t xdr_ypxfrstat (XDR *, ypxfrstat*);
313 extern bool_t xdr_domainname (XDR *, domainname*);
314 extern bool_t xdr_mapname (XDR *, mapname*);
315 extern bool_t xdr_peername (XDR *, peername*);
316 extern bool_t xdr_keydat (XDR *, keydat*);
317 extern bool_t xdr_valdat (XDR *, valdat*);
318 extern bool_t xdr_ypmap_parms (XDR *, ypmap_parms*);
319 extern bool_t xdr_ypreq_key (XDR *, ypreq_key*);
320 extern bool_t xdr_ypreq_nokey (XDR *, ypreq_nokey*);
321 extern bool_t xdr_ypreq_xfr (XDR *, ypreq_xfr*);
322 extern bool_t xdr_ypresp_val (XDR *, ypresp_val*);
323 extern bool_t xdr_ypresp_key_val (XDR *, ypresp_key_val*);
324 extern bool_t xdr_ypresp_master (XDR *, ypresp_master*);
325 extern bool_t xdr_ypresp_order (XDR *, ypresp_order*);
326 extern bool_t xdr_ypresp_all (XDR *, ypresp_all*);
327 extern bool_t xdr_ypresp_xfr (XDR *, ypresp_xfr*);
328 extern bool_t xdr_ypmaplist (XDR *, ypmaplist*);
329 extern bool_t xdr_ypresp_maplist (XDR *, ypresp_maplist*);
330 extern bool_t xdr_yppush_status (XDR *, yppush_status*);
331 extern bool_t xdr_yppushresp_xfr (XDR *, yppushresp_xfr*);
332 extern bool_t xdr_ypbind_resptype (XDR *, ypbind_resptype*);
333 extern bool_t xdr_ypbind_binding (XDR *, ypbind_binding*);
334 extern bool_t xdr_ypbind_resp (XDR *, ypbind_resp*);
335 extern bool_t xdr_ypbind_setdom (XDR *, ypbind_setdom*);
337 __END_DECLS
339 #endif /* !__RPCSVC_YP_H__ */