1/*
2 * Copyright (c) 2010, Oracle America, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
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.
17 *
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.
30 */
31
32#ifndef __RPCSVC_YP_H__
33#define __RPCSVC_YP_H__
34
35#include <features.h>
36#include <rpc/rpc.h>
37
38#define YPMAXRECORD 1024
39#define YPMAXDOMAIN 64
40#define YPMAXMAP 64
41#define YPMAXPEER 64
42
43enum 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,
55};
56typedef enum ypstat ypstat;
57
58enum 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,
75};
76typedef enum ypxfrstat ypxfrstat;
77
78typedef char *domainname;
79typedef char *mapname;
80typedef char *peername;
81
82typedef struct {
83 u_int keydat_len;
84 char *keydat_val;
85} keydat;
86
87typedef struct {
88 u_int valdat_len;
89 char *valdat_val;
90} valdat;
91
92struct ypmap_parms {
93 domainname domain;
94 mapname map;
95 u_int ordernum;
96 peername peer;
97};
98typedef struct ypmap_parms ypmap_parms;
99
100struct ypreq_key {
101 domainname domain;
102 mapname map;
103 keydat key;
104};
105typedef struct ypreq_key ypreq_key;
106
107struct ypreq_nokey {
108 domainname domain;
109 mapname map;
110};
111typedef struct ypreq_nokey ypreq_nokey;
112
113struct ypreq_xfr {
114 ypmap_parms map_parms;
115 u_int transid;
116 u_int prog;
117 u_int port;
118};
119typedef struct ypreq_xfr ypreq_xfr;
120
121struct ypresp_val {
122 ypstat stat;
123 valdat val;
124};
125typedef struct ypresp_val ypresp_val;
126
127struct 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
141};
142typedef struct ypresp_key_val ypresp_key_val;
143
144struct ypresp_master {
145 ypstat stat;
146 peername peer;
147};
148typedef struct ypresp_master ypresp_master;
149
150struct ypresp_order {
151 ypstat stat;
152 u_int ordernum;
153};
154typedef struct ypresp_order ypresp_order;
155
156struct ypresp_all {
157 bool_t more;
158 union {
159 ypresp_key_val val;
160 } ypresp_all_u;
161};
162typedef struct ypresp_all ypresp_all;
163
164struct ypresp_xfr {
165 u_int transid;
166 ypxfrstat xfrstat;
167};
168typedef struct ypresp_xfr ypresp_xfr;
169
170struct ypmaplist {
171 mapname map;
172 struct ypmaplist *next;
173};
174typedef struct ypmaplist ypmaplist;
175
176struct ypresp_maplist {
177 ypstat stat;
178 ypmaplist *maps;
179};
180typedef struct ypresp_maplist ypresp_maplist;
181
182enum 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,
199};
200typedef enum yppush_status yppush_status;
201
202struct yppushresp_xfr {
203 u_int transid;
204 yppush_status status;
205};
206typedef struct yppushresp_xfr yppushresp_xfr;
207
208enum ypbind_resptype {
209 YPBIND_SUCC_VAL = 1,
210 YPBIND_FAIL_VAL = 2,
211};
212typedef enum ypbind_resptype ypbind_resptype;
213
214struct ypbind_binding {
215 char ypbind_binding_addr[4];
216 char ypbind_binding_port[2];
217};
218typedef struct ypbind_binding ypbind_binding;
219
220struct ypbind_resp {
221 ypbind_resptype ypbind_status;
222 union {
223 u_int ypbind_error;
224 ypbind_binding ypbind_bindinfo;
225 } ypbind_resp_u;
226};
227typedef struct ypbind_resp ypbind_resp;
228
229#define YPBIND_ERR_ERR 1
230#define YPBIND_ERR_NOSERV 2
231#define YPBIND_ERR_RESC 3
232
233struct ypbind_setdom {
234 domainname ypsetdom_domain;
235 ypbind_binding ypsetdom_binding;
236 u_int ypsetdom_vers;
237};
238typedef struct ypbind_setdom ypbind_setdom;
239
240__BEGIN_DECLS
241
242#define YPPROG 100004
243#define YPVERS 2
244
245#define YPPROC_NULL 0
246extern void *ypproc_null_2 (void *, CLIENT *);
247extern void *ypproc_null_2_svc (void *, struct svc_req *);
248#define YPPROC_DOMAIN 1
249extern bool_t *ypproc_domain_2 (domainname *, CLIENT *);
250extern bool_t *ypproc_domain_2_svc (domainname *, struct svc_req *);
251#define YPPROC_DOMAIN_NONACK 2
252extern bool_t *ypproc_domain_nonack_2 (domainname *, CLIENT *);
253extern bool_t *ypproc_domain_nonack_2_svc (domainname *, struct svc_req *);
254#define YPPROC_MATCH 3
255extern ypresp_val *ypproc_match_2 (ypreq_key *, CLIENT *);
256extern ypresp_val *ypproc_match_2_svc (ypreq_key *, struct svc_req *);
257#define YPPROC_FIRST 4
258extern ypresp_key_val *ypproc_first_2 (ypreq_key *, CLIENT *);
259extern ypresp_key_val *ypproc_first_2_svc (ypreq_key *, struct svc_req *);
260#define YPPROC_NEXT 5
261extern ypresp_key_val *ypproc_next_2 (ypreq_key *, CLIENT *);
262extern ypresp_key_val *ypproc_next_2_svc (ypreq_key *, struct svc_req *);
263#define YPPROC_XFR 6
264extern ypresp_xfr *ypproc_xfr_2 (ypreq_xfr *, CLIENT *);
265extern ypresp_xfr *ypproc_xfr_2_svc (ypreq_xfr *, struct svc_req *);
266#define YPPROC_CLEAR 7
267extern void *ypproc_clear_2 (void *, CLIENT *);
268extern void *ypproc_clear_2_svc (void *, struct svc_req *);
269#define YPPROC_ALL 8
270extern ypresp_all *ypproc_all_2 (ypreq_nokey *, CLIENT *);
271extern ypresp_all *ypproc_all_2_svc (ypreq_nokey *, struct svc_req *);
272#define YPPROC_MASTER 9
273extern ypresp_master *ypproc_master_2 (ypreq_nokey *, CLIENT *);
274extern ypresp_master *ypproc_master_2_svc (ypreq_nokey *, struct svc_req *);
275#define YPPROC_ORDER 10
276extern ypresp_order *ypproc_order_2 (ypreq_nokey *, CLIENT *);
277extern ypresp_order *ypproc_order_2_svc (ypreq_nokey *, struct svc_req *);
278#define YPPROC_MAPLIST 11
279extern ypresp_maplist *ypproc_maplist_2 (domainname *, CLIENT *);
280extern ypresp_maplist *ypproc_maplist_2_svc (domainname *, struct svc_req *);
281extern int ypprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
282
283
284#define YPPUSH_XFRRESPPROG (0x40000000)
285#define YPPUSH_XFRRESPVERS 1
286
287#define YPPUSHPROC_NULL 0
288extern void *yppushproc_null_1 (void *, CLIENT *);
289extern void *yppushproc_null_1_svc (void *, struct svc_req *);
290#define YPPUSHPROC_XFRRESP 1
291extern void *yppushproc_xfrresp_1 (yppushresp_xfr *, CLIENT *);
292extern void *yppushproc_xfrresp_1_svc (yppushresp_xfr *, struct svc_req *);
293extern int yppush_xfrrespprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
294
295
296#define YPBINDPROG 100007
297#define YPBINDVERS 2
298
299#define YPBINDPROC_NULL 0
300extern void *ypbindproc_null_2 (void *, CLIENT *);
301extern void *ypbindproc_null_2_svc (void *, struct svc_req *);
302#define YPBINDPROC_DOMAIN 1
303extern ypbind_resp *ypbindproc_domain_2 (domainname *, CLIENT *);
304extern ypbind_resp *ypbindproc_domain_2_svc (domainname *, struct svc_req *);
305#define YPBINDPROC_SETDOM 2
306extern void *ypbindproc_setdom_2 (ypbind_setdom *, CLIENT *);
307extern void *ypbindproc_setdom_2_svc (ypbind_setdom *, struct svc_req *);
308extern int ypbindprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
309
310
311extern bool_t xdr_ypstat (XDR *, ypstat*);
312extern bool_t xdr_ypxfrstat (XDR *, ypxfrstat*);
313extern bool_t xdr_domainname (XDR *, domainname*);
314extern bool_t xdr_mapname (XDR *, mapname*);
315extern bool_t xdr_peername (XDR *, peername*);
316extern bool_t xdr_keydat (XDR *, keydat*);
317extern bool_t xdr_valdat (XDR *, valdat*);
318extern bool_t xdr_ypmap_parms (XDR *, ypmap_parms*);
319extern bool_t xdr_ypreq_key (XDR *, ypreq_key*);
320extern bool_t xdr_ypreq_nokey (XDR *, ypreq_nokey*);
321extern bool_t xdr_ypreq_xfr (XDR *, ypreq_xfr*);
322extern bool_t xdr_ypresp_val (XDR *, ypresp_val*);
323extern bool_t xdr_ypresp_key_val (XDR *, ypresp_key_val*);
324extern bool_t xdr_ypresp_master (XDR *, ypresp_master*);
325extern bool_t xdr_ypresp_order (XDR *, ypresp_order*);
326extern bool_t xdr_ypresp_all (XDR *, ypresp_all*);
327extern bool_t xdr_ypresp_xfr (XDR *, ypresp_xfr*);
328extern bool_t xdr_ypmaplist (XDR *, ypmaplist*);
329extern bool_t xdr_ypresp_maplist (XDR *, ypresp_maplist*);
330extern bool_t xdr_yppush_status (XDR *, yppush_status*);
331extern bool_t xdr_yppushresp_xfr (XDR *, yppushresp_xfr*);
332extern bool_t xdr_ypbind_resptype (XDR *, ypbind_resptype*);
333extern bool_t xdr_ypbind_binding (XDR *, ypbind_binding*);
334extern bool_t xdr_ypbind_resp (XDR *, ypbind_resp*);
335extern bool_t xdr_ypbind_setdom (XDR *, ypbind_setdom*);
336
337__END_DECLS
338
339#endif /* !__RPCSVC_YP_H__ */
340

source code of glibc/nis/rpcsvc/yp.h