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