source: rtems-libbsd/freebsd/include/rpcsvc/yp_prot.h @ 9880635

5-freebsd-12freebsd-9.3
Last change on this file since 9880635 was 9880635, checked in by Sebastian Huber <sebastian.huber@…>, on Jun 9, 2016 at 8:48:05 AM

RPC(3): Port to RTEMS

  • Property mode set to 100644
File size: 10.4 KB
Line 
1/*
2 * Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote
14 *    products derived from this software without specific prior written
15 *    permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD$
30 */
31
32#ifndef _RPCSVC_YP_PROT_H_
33#define _RPCSVC_YP_PROT_H_
34
35/*
36 * YPSERV PROTOCOL:
37 *
38 * ypserv supports the following procedures:
39 *
40 * YPPROC_NULL          takes (void), returns (void).
41 *                      called to check if server is alive.
42 * YPPROC_DOMAIN        takes (char *), returns (bool_t).
43 *                      true if ypserv serves the named domain.
44 * YPPROC_DOMAIN_NOACK  takes (char *), returns (bool_t).
45 *                      true if ypserv serves the named domain.
46 *                      used for broadcasts, does not ack if ypserv
47 *                      doesn't handle named domain.
48 * YPPROC_MATCH         takes (struct ypreq_key), returns (struct ypresp_val)
49 *                      does a lookup.
50 * YPPROC_FIRST         takes (struct ypreq_nokey) returns (ypresp_key_val).
51 *                      gets the first key/datum from the map.
52 * YPPROC_NEXT          takes (struct ypreq_key) returns (ypresp_key_val).
53 *                      gets the next key/datum from the map.
54 * YPPROC_XFR           takes (struct ypreq_xfr), returns (void).
55 *                      tells ypserv to check if there is a new version of
56 *                      the map.
57 * YPPROC_CLEAR         takes (void), returns (void).
58 *                      tells ypserv to flush it's file cache, so that
59 *                      newly transferred files will get read.
60 * YPPROC_ALL           takes (struct ypreq_nokey), returns (bool_t and
61 *                      struct ypresp_key_val).
62 *                      returns an array of data, with the bool_t being
63 *                      false on the last datum. read the source, it's
64 *                      convoluted.
65 * YPPROC_MASTER        takes (struct ypreq_nokey), returns (ypresp_master).
66 * YPPROC_ORDER         takes (struct ypreq_nokey), returns (ypresp_order).
67 * YPPROC_MAPLIST       takes (char *), returns (struct ypmaplist *).
68 */
69
70#ifndef __rtems__
71#ifndef BOOL_DEFINED
72typedef u_int bool;
73#define BOOL_DEFINED
74#endif
75#endif /* __rtems__ */
76
77/* Program and version symbols, magic numbers */
78
79#define YPPROG          ((u_long)100004)
80#define YPVERS          ((u_long)2)
81#define YPVERS_ORIG     ((u_long)1)
82#define YPMAXRECORD     ((u_long)1024)
83#define YPMAXDOMAIN     ((u_long)64)
84#define YPMAXMAP        ((u_long)64)
85#define YPMAXPEER       ((u_long)256)
86
87/*
88 * I don't know if anything of sun's depends on this, or if they
89 * simply defined it so that their own code wouldn't try to send
90 * packets over the ethernet MTU. This YP code doesn't use it.
91 */
92#define YPMSGSZ         1600
93
94#ifndef DATUM
95typedef struct {
96        char    *dptr;
97        int     dsize;
98} datum;
99#define DATUM
100#endif
101
102struct ypmap_parms {
103        char *domain;
104        char *map;
105        u_int ordernum;
106        char *owner;
107};
108
109struct ypreq_key {
110        char *domain;
111        char *map;
112        datum keydat;
113};
114
115struct ypreq_nokey {
116        char *domain;
117        char *map;
118};
119
120struct ypreq_xfr {
121        struct ypmap_parms map_parms;
122        u_int transid;
123        u_int proto;
124        u_int port;
125};
126#define ypxfr_domain    map_parms.domain
127#define ypxfr_map       map_parms.map
128#define ypxfr_ordernum  map_parms.ordernum
129#define ypxfr_owner     map_parms.owner
130
131struct ypresp_val {
132        u_int status;
133        datum valdat;
134};
135
136struct ypresp_key_val {
137        u_int status;
138        datum keydat;
139        datum valdat;
140};
141
142struct ypresp_master {
143        u_int status;
144        char *master;
145};
146
147struct ypresp_order {
148        u_int status;
149        u_int ordernum;
150};
151
152struct ypmaplist {
153        char *ypml_name;
154        struct ypmaplist *ypml_next;
155};
156
157struct ypresp_maplist {
158        u_int status;
159        struct ypmaplist *list;
160};
161
162/* ypserv procedure numbers */
163#define YPPROC_NULL             ((u_long)0)
164#define YPPROC_DOMAIN           ((u_long)1)
165#define YPPROC_DOMAIN_NONACK    ((u_long)2)
166#define YPPROC_MATCH            ((u_long)3)
167#define YPPROC_FIRST            ((u_long)4)
168#define YPPROC_NEXT             ((u_long)5)
169#define YPPROC_XFR              ((u_long)6)
170#define YPPROC_CLEAR            ((u_long)7)
171#define YPPROC_ALL              ((u_long)8)
172#define YPPROC_MASTER           ((u_long)9)
173#define YPPROC_ORDER            ((u_long)10)
174#define YPPROC_MAPLIST          ((u_long)11)
175
176/* ypserv procedure return status values */
177#define YP_TRUE         ((long)1)       /* general purpose success code */
178#define YP_NOMORE       ((long)2)       /* no more entries in map */
179#define YP_FALSE        ((long)0)       /* general purpose failure code */
180#define YP_NOMAP        ((long)-1)      /* no such map in domain */
181#define YP_NODOM        ((long)-2)      /* domain not supported */
182#define YP_NOKEY        ((long)-3)      /* no such key in map */
183#define YP_BADOP        ((long)-4)      /* invalid operation */
184#define YP_BADDB        ((long)-5)      /* server data base is bad */
185#define YP_YPERR        ((long)-6)      /* YP server error */
186#define YP_BADARGS      ((long)-7)      /* request arguments bad */
187#define YP_VERS         ((long)-8)      /* YP server version mismatch */
188
189/*
190 * Sun's header file says:
191 * "Domain binding data structure, used by ypclnt package and ypserv modules.
192 * Users of the ypclnt package (or of this protocol) don't HAVE to know about
193 * it, but it must be available to users because _yp_dobind is a public
194 * interface."
195 *
196 * This is totally bogus! Nowhere else does Sun state that _yp_dobind() is
197 * a public interface, and I don't know any reason anyone would want to call
198 * it. But, just in case anyone does actually expect it to be available..
199 * we provide this.. exactly as Sun wants it.
200 */
201struct dom_binding {
202        struct dom_binding *dom_pnext;
203        char dom_domain[YPMAXDOMAIN + 1];
204        struct sockaddr_in dom_server_addr;
205        u_short dom_server_port;
206        int dom_socket;
207        CLIENT *dom_client;
208        u_short dom_local_port;
209        long dom_vers;
210};
211
212/*
213 * YPBIND PROTOCOL:
214 *
215 * ypbind supports the following procedures:
216 *
217 * YPBINDPROC_NULL      takes (void), returns (void).
218 *                      to check if ypbind is running.
219 * YPBINDPROC_DOMAIN    takes (char *), returns (struct ypbind_resp).
220 *                      requests that ypbind start to serve the
221 *                      named domain (if it doesn't already)
222 * YPBINDPROC_SETDOM    takes (struct ypbind_setdom), returns (void).
223 *                      used by ypset.
224 */
225
226#define YPBINDPROG              ((u_long)100007)
227#define YPBINDVERS              ((u_long)2)
228#define YPBINDVERS_ORIG         ((u_long)1)
229
230/* ypbind procedure numbers */
231#define YPBINDPROC_NULL         ((u_long)0)
232#define YPBINDPROC_DOMAIN       ((u_long)1)
233#define YPBINDPROC_SETDOM       ((u_long)2)
234
235/* error code in ypbind_resp.ypbind_status */
236enum ypbind_resptype {
237        YPBIND_SUCC_VAL = 1,
238        YPBIND_FAIL_VAL = 2,
239        _YPBIND_RESPTYPE = 0xffffffff
240};
241
242/* network order, of course */
243struct ypbind_binding {
244        struct in_addr  ypbind_binding_addr;
245        u_short         ypbind_binding_port;
246};
247
248struct ypbind_resp {
249        enum ypbind_resptype    ypbind_status;
250        union {
251                u_int                   ypbind_error;
252                struct ypbind_binding   ypbind_bindinfo;
253        } ypbind_respbody;
254};
255
256/* error code in ypbind_resp.ypbind_respbody.ypbind_error */
257#define YPBIND_ERR_ERR          1       /* internal error */
258#define YPBIND_ERR_NOSERV       2       /* no bound server for passed domain */
259#define YPBIND_ERR_RESC         3       /* system resource allocation failure */
260
261/*
262 * Request data structure for ypbind "Set domain" procedure.
263 */
264struct ypbind_setdom {
265        char ypsetdom_domain[YPMAXDOMAIN + 1];
266        struct ypbind_binding ypsetdom_binding;
267        u_int ypsetdom_vers;
268};
269#define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
270#define ypsetdom_port ypsetdom_binding.ypbind_binding_port
271
272/*
273 * YPPUSH PROTOCOL:
274 *
275 * Sun says:
276 * "Protocol between clients (ypxfr, only) and yppush
277 *  yppush speaks a protocol in the transient range, which
278 *  is supplied to ypxfr as a command-line parameter when it
279 *  is activated by ypserv."
280 *
281 * This protocol is not implemented, naturally, because this YP
282 * implementation only does the client side.
283 */
284#define YPPUSHVERS              ((u_long)1)
285#define YPPUSHVERS_ORIG         ((u_long)1)
286
287/* yppush procedure numbers */
288#define YPPUSHPROC_NULL         ((u_long)0)
289#define YPPUSHPROC_XFRRESP      ((u_long)1)
290
291struct yppushresp_xfr {
292        u_int   transid;
293        u_int   status;
294};
295
296/* yppush status value in yppushresp_xfr.status */
297#define YPPUSH_SUCC     ((long)1)       /* Success */
298#define YPPUSH_AGE      ((long)2)       /* Master's version not newer */
299#define YPPUSH_NOMAP    ((long)-1)      /* Can't find server for map */
300#define YPPUSH_NODOM    ((long)-2)      /* Domain not supported */
301#define YPPUSH_RSRC     ((long)-3)      /* Local resource alloc failure */
302#define YPPUSH_RPC      ((long)-4)      /* RPC failure talking to server */
303#define YPPUSH_MADDR    ((long)-5)      /* Can't get master address */
304#define YPPUSH_YPERR    ((long)-6)      /* YP server/map db error */
305#define YPPUSH_BADARGS  ((long)-7)      /* Request arguments bad */
306#define YPPUSH_DBM      ((long)-8)      /* Local dbm operation failed */
307#define YPPUSH_FILE     ((long)-9)      /* Local file I/O operation failed */
308#define YPPUSH_SKEW     ((long)-10)     /* Map version skew during transfer */
309#define YPPUSH_CLEAR    ((long)-11)     /* Can't send "Clear" req to local ypserv */
310#define YPPUSH_FORCE    ((long)-12)     /* No local order number in map - use -f */
311#define YPPUSH_XFRERR   ((long)-13)     /* ypxfr error */
312#define YPPUSH_REFUSED  ((long)-14)     /* Transfer request refused by ypserv */
313
314struct inaddr;
315__BEGIN_DECLS
316bool_t  xdr_datum(XDR *, datum *);
317bool_t  xdr_ypreq_key(XDR *, struct ypreq_key *);
318bool_t  xdr_ypreq_nokey(XDR *, struct ypreq_nokey *);
319bool_t  xdr_ypreq_xfr(XDR *, struct ypreq_xfr *);
320bool_t  xdr_ypresp_val(XDR *, struct ypresp_val *);
321bool_t  xdr_ypresp_key_val(XDR *, struct ypresp_key_val *);
322bool_t  xdr_ypbind_resp(XDR *, struct ypbind_resp *);
323bool_t  xdr_ypbind_setdom(XDR *, struct ypbind_setdom *);
324bool_t  xdr_yp_inaddr(XDR *, struct inaddr *);
325bool_t  xdr_ypmap_parms(XDR *, struct ypmap_parms *);
326bool_t  xdr_yppushresp_xfr(XDR *, struct yppushresp_xfr *);
327bool_t  xdr_ypresp_order(XDR *, struct ypresp_order *);
328bool_t  xdr_ypresp_master(XDR *, struct ypresp_master *);
329bool_t  xdr_ypresp_maplist(XDR *, struct ypresp_maplist *);
330__END_DECLS
331
332#endif /* _RPCSVC_YP_PROT_H_ */
Note: See TracBrowser for help on using the repository browser.