Print this page
remove support for non-ANSI compilation
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/rpcsvc/yp_prot.h
+++ new/usr/src/head/rpcsvc/yp_prot.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 + *
23 25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 26 * Use is subject to license terms.
25 27 */
26 28
27 29 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 30 /* All Rights Reserved */
29 31
30 32 /*
31 33 * Portions of this source code were derived from Berkeley 4.3 BSD
32 34 * under license from the Regents of the University of California.
33 35 */
34 36
35 37 #ifndef _RPCSVC_YP_PROT_H
36 38 #define _RPCSVC_YP_PROT_H
37 39
38 -#pragma ident "%Z%%M% %I% %E% SMI"
39 -
40 40 #include <rpc/rpc.h>
41 41 #include <rpcsvc/ypclnt.h>
42 42 #include <ndbm.h>
43 43
44 44 #ifdef __cplusplus
45 45 extern "C" {
46 46 #endif
47 47
48 48 /*
49 49 * This file contains symbols and structures defining the rpc protocol
50 50 * between the YP clients and the YP servers. The servers are the YP
51 51 * database servers, and the YP.
52 52 */
53 53
54 54 /*
55 55 * The following procedures are supported by the protocol:
56 56 *
57 57 * YPPROC_NULL() returns () takes nothing, returns nothing. This indicates
58 58 * that the yp server is alive.
59 59 *
60 60 * YPPROC_DOMAIN (char *) returns (bool_t) TRUE. Indicates that the
61 61 * responding yp server does serve the named domain; FALSE indicates no
62 62 * support.
63 63 *
64 64 * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the yp server does serve
65 65 * the named domain, otherwise does not return. Used in the broadcast case.
66 66 *
67 67 * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val). Returns the
68 68 * right-hand value for a passed left-hand key, within a named map and
69 69 * domain.
70 70 *
71 71 * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val).
72 72 * Returns the first key-value pair from a named domain and map.
73 73 *
74 74 * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val). Returns
75 75 * the key-value pair following a passed key-value pair within a named
76 76 * domain and map.
77 77 *
78 78 * YPPROC_XFR (struct ypreq_xfr) returns nothing. Indicates to a server that
79 79 * a map should be updated.
80 80 *
81 81 * YPPROC_NEWXFR (struct ypreq_newxfr) returns nothing. Indicates to a server
82 82 * that a map should be updated. Uses protocol independent request struct.
83 83 *
84 84 * YPPROC_CLEAR takes nothing, returns nothing. Instructs a yp server to
85 85 * close the current map, so that old versions of the disk file don't get
86 86 * held open.
87 87 *
88 88 * YPPROC_ALL (struct ypreq_nokey), returns
89 89 * union switch (bool more) {
90 90 * TRUE: (struct ypresp_key_val);
91 91 * FALSE: (struct) {};
92 92 * }
93 93 *
94 94 * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master)
95 95 *
96 96 * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order)
97 97 *
98 98 * YPPROC_MAPLIST (char *), returns (struct ypmaplist *)
99 99 */
100 100
101 101 /* 'bool' is a built-in type for g++ */
102 102 #if !(defined(__cplusplus) && defined(_BOOL)) && !defined(__GNUG__)
103 103 #ifndef BOOL_DEFINED
104 104 typedef unsigned int bool;
105 105 #define BOOL_DEFINED
106 106 #endif
107 107 #endif
108 108
109 109 /* Program and version symbols, magic numbers */
110 110
111 111 #define YPPROG ((rpcprog_t)100004)
112 112 #define YPVERS ((rpcvers_t)2)
113 113 #define YPVERS_ORIG ((rpcvers_t)1)
114 114 #define YPMAXRECORD ((uint_t)1024)
115 115 #define YPMAXDOMAIN ((uint_t)256)
116 116 #define YPMAXMAP ((uint_t)64)
117 117 #define YPMAXPEER ((uint_t)256)
118 118
119 119 /* byte size of a large yp packet */
120 120 #define YPMSGSZ 1600
121 121
122 122 struct ypmap_parms {
123 123 char *domain; /* Null string means not available */
124 124 char *map; /* Null string means not available */
125 125 unsigned int ordernum; /* 0 means not available */
126 126 char *owner; /* Null string means not available */
127 127 };
128 128
129 129 /*
130 130 * Request parameter structures
131 131 */
132 132
133 133 struct ypreq_key {
134 134 char *domain;
135 135 char *map;
136 136 datum keydat;
137 137 };
138 138
139 139 struct ypreq_nokey {
140 140 char *domain;
141 141 char *map;
142 142 };
143 143
144 144 struct ypreq_xfr {
145 145 struct ypmap_parms map_parms;
146 146 unsigned int transid;
147 147 unsigned int proto;
148 148 unsigned short port;
149 149 };
150 150
151 151 struct ypreq_newxfr {
152 152 struct ypmap_parms map_parms;
153 153 unsigned int transid;
154 154 unsigned int proto;
155 155 char *name;
156 156 };
157 157
158 158 #define ypxfr_domain map_parms.domain
159 159 #define ypxfr_map map_parms.map
160 160 #define ypxfr_ordernum map_parms.ordernum
161 161 #define ypxfr_owner map_parms.owner
162 162
163 163 /*
164 164 * Response parameter structures
165 165 */
166 166
167 167 struct ypresp_val {
168 168 unsigned int status;
169 169 datum valdat;
170 170 };
171 171
172 172 struct ypresp_key_val {
173 173 unsigned int status;
174 174 datum valdat;
175 175 datum keydat;
176 176 };
177 177
178 178 struct ypresp_master {
179 179 unsigned int status;
180 180 char *master;
181 181 };
182 182
183 183 struct ypresp_order {
184 184 unsigned int status;
185 185 unsigned int ordernum;
186 186 };
187 187
188 188 struct ypmaplist {
189 189 char ypml_name[YPMAXMAP + 1];
190 190 struct ypmaplist *ypml_next;
191 191 };
192 192
193 193 struct ypresp_maplist {
194 194 unsigned int status;
195 195 struct ypmaplist *list;
196 196 };
197 197
198 198 /*
199 199 * Procedure symbols. YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK
200 200 * must keep the same values (0, 1, and 2) that they had in the first version
201 201 * of the protocol.
202 202 */
203 203
204 204 #define YPPROC_NULL ((rpcproc_t)0)
205 205 #define YPPROC_DOMAIN ((rpcproc_t)1)
206 206 #define YPPROC_DOMAIN_NONACK ((rpcproc_t)2)
207 207 #define YPPROC_MATCH ((rpcproc_t)3)
208 208 #define YPPROC_FIRST ((rpcproc_t)4)
209 209 #define YPPROC_NEXT ((rpcproc_t)5)
210 210 #define YPPROC_XFR ((rpcproc_t)6)
211 211 #define YPPROC_NEWXFR ((rpcproc_t)12)
212 212 #define YPPROC_CLEAR ((rpcproc_t)7)
213 213 #define YPPROC_ALL ((rpcproc_t)8)
214 214 #define YPPROC_MASTER ((rpcproc_t)9)
215 215 #define YPPROC_ORDER ((rpcproc_t)10)
216 216 #define YPPROC_MAPLIST ((rpcproc_t)11)
217 217
218 218 /* Return status values */
219 219
220 220 #define YP_TRUE (1) /* General purpose success code */
221 221 #define YP_NOMORE (2) /* No more entries in map */
222 222 #define YP_FALSE (0) /* General purpose failure code */
223 223 #define YP_NOMAP (-1) /* No such map in domain */
224 224 #define YP_NODOM (-2) /* Domain not supported */
225 225 #define YP_NOKEY (-3) /* No such key in map */
226 226 #define YP_BADOP (-4) /* Invalid operation */
227 227 #define YP_BADDB (-5) /* Server data base is bad */
228 228 #define YP_YPERR (-6) /* YP server error */
229 229 #define YP_BADARGS (-7) /* Request arguments bad */
230 230 #define YP_VERS (-8) /* YP server vers. mismatch - server */
231 231 /* can't supply requested service. */
232 232
233 233 enum ypreqtype {YPREQ_KEY = 1, YPREQ_NOKEY = 2, YPREQ_MAP_PARMS = 3};
234 234 struct yprequest {
235 235 enum ypreqtype yp_reqtype;
236 236 union {
237 237 struct ypreq_key yp_req_keytype;
238 238 struct ypreq_nokey yp_req_nokeytype;
239 239 struct ypmap_parms yp_req_map_parmstype;
240 240 }yp_reqbody;
241 241 };
242 242
243 243 #define YPMATCH_REQTYPE YPREQ_KEY
244 244 #define ypmatch_req_domain yp_reqbody.yp_req_keytype.domain
245 245 #define ypmatch_req_map yp_reqbody.yp_req_keytype.map
246 246 #define ypmatch_req_keydat yp_reqbody.yp_req_keytype.keydat
247 247 #define ypmatch_req_keyptr yp_reqbody.yp_req_keytype.keydat.dptr
248 248 #define ypmatch_req_keysize yp_reqbody.yp_req_keytype.keydat.dsize
249 249
250 250 #define YPFIRST_REQTYPE YPREQ_NOKEY
251 251 #define ypfirst_req_domain yp_reqbody.yp_req_nokeytype.domain
252 252 #define ypfirst_req_map yp_reqbody.yp_req_nokeytype.map
253 253
254 254 #define YPNEXT_REQTYPE YPREQ_KEY
255 255 #define ypnext_req_domain yp_reqbody.yp_req_keytype.domain
256 256 #define ypnext_req_map yp_reqbody.yp_req_keytype.map
257 257 #define ypnext_req_keydat yp_reqbody.yp_req_keytype.keydat
258 258 #define ypnext_req_keyptr yp_reqbody.yp_req_keytype.keydat.dptr
259 259 #define ypnext_req_keysize yp_reqbody.yp_req_keytype.keydat.dsize
260 260
261 261 #define YPPUSH_REQTYPE YPREQ_NOKEY
262 262 #define yppush_req_domain yp_reqbody.yp_req_nokeytype.domain
263 263 #define yppush_req_map yp_reqbody.yp_req_nokeytype.map
264 264
265 265 #define YPPULL_REQTYPE YPREQ_NOKEY
266 266 #define yppull_req_domain yp_reqbody.yp_req_nokeytype.domain
267 267 #define yppull_req_map yp_reqbody.yp_req_nokeytype.map
268 268
269 269 #define YPPOLL_REQTYPE YPREQ_NOKEY
270 270 #define yppoll_req_domain yp_reqbody.yp_req_nokeytype.domain
271 271 #define yppoll_req_map yp_reqbody.yp_req_nokeytype.map
272 272
273 273 #define YPGET_REQTYPE YPREQ_MAP_PARMS
274 274 #define ypget_req_domain yp_reqbody.yp_req_map_parmstype.domain
275 275 #define ypget_req_map yp_reqbody.yp_req_map_parmstype.map
276 276 #define ypget_req_ordernum yp_reqbody.yp_req_map_parmstype.ordernum
277 277 #define ypget_req_owner yp_reqbody.yp_req_map_parmstype.owner
278 278
279 279 enum ypresptype {YPRESP_VAL = 1, YPRESP_KEY_VAL = 2, YPRESP_MAP_PARMS = 3};
280 280 struct ypresponse {
281 281 enum ypresptype yp_resptype;
282 282 union {
283 283 struct ypresp_val yp_resp_valtype;
284 284 struct ypresp_key_val yp_resp_key_valtype;
285 285 struct ypmap_parms yp_resp_map_parmstype;
286 286 } yp_respbody;
287 287 };
288 288
289 289 #define YPMATCH_RESPTYPE YPRESP_VAL
290 290 #define ypmatch_resp_status yp_respbody.yp_resp_valtype.status
291 291 #define ypmatch_resp_valdat yp_respbody.yp_resp_valtype.valdat
292 292 #define ypmatch_resp_valptr yp_respbody.yp_resp_valtype.valdat.dptr
293 293 #define ypmatch_resp_valsize yp_respbody.yp_resp_valtype.valdat.dsize
294 294
295 295 #define YPFIRST_RESPTYPE YPRESP_KEY_VAL
296 296 #define ypfirst_resp_status yp_respbody.yp_resp_key_valtype.status
297 297 #define ypfirst_resp_keydat yp_respbody.yp_resp_key_valtype.keydat
298 298 #define ypfirst_resp_keyptr yp_respbody.yp_resp_key_valtype.keydat.dptr
299 299 #define ypfirst_resp_keysize yp_respbody.yp_resp_key_valtype.keydat.dsize
300 300 #define ypfirst_resp_valdat yp_respbody.yp_resp_key_valtype.valdat
301 301 #define ypfirst_resp_valptr yp_respbody.yp_resp_key_valtype.valdat.dptr
302 302 #define ypfirst_resp_valsize yp_respbody.yp_resp_key_valtype.valdat.dsize
303 303
304 304 #define YPNEXT_RESPTYPE YPRESP_KEY_VAL
305 305 #define ypnext_resp_status yp_respbody.yp_resp_key_valtype.status
306 306 #define ypnext_resp_keydat yp_respbody.yp_resp_key_valtype.keydat
307 307 #define ypnext_resp_keyptr yp_respbody.yp_resp_key_valtype.keydat.dptr
308 308 #define ypnext_resp_keysize yp_respbody.yp_resp_key_valtype.keydat.dsize
309 309 #define ypnext_resp_valdat yp_respbody.yp_resp_key_valtype.valdat
310 310 #define ypnext_resp_valptr yp_respbody.yp_resp_key_valtype.valdat.dptr
311 311 #define ypnext_resp_valsize yp_respbody.yp_resp_key_valtype.valdat.dsize
312 312
313 313 #define YPPOLL_RESPTYPE YPRESP_MAP_PARMS
314 314 #define yppoll_resp_domain yp_respbody.yp_resp_map_parmstype.domain
315 315 #define yppoll_resp_map yp_respbody.yp_resp_map_parmstype.map
316 316 #define yppoll_resp_ordernum yp_respbody.yp_resp_map_parmstype.ordernum
317 317 #define yppoll_resp_owner yp_respbody.yp_resp_map_parmstype.owner
318 318
319 319
320 320 extern bool _xdr_yprequest();
321 321 extern bool _xdr_ypresponse();
322 322 /*
323 323 * Protocol between clients (ypxfr, only) and yppush
324 324 * yppush speaks a protocol in the transient range, which
325 325 * is supplied to ypxfr as a command-line parameter when it
326 326 * is activated by ypserv.
327 327 */
328 328 #define YPPUSHVERS ((rpcvers_t)1)
329 329 #define YPPUSHVERS_ORIG ((rpcvers_t)1)
330 330
331 331 /* Procedure symbols */
332 332
333 333 #define YPPUSHPROC_NULL ((rpcproc_t)0)
334 334 #define YPPUSHPROC_XFRRESP ((rpcproc_t)1)
335 335
336 336 struct yppushresp_xfr {
337 337 unsigned int transid;
338 338 unsigned int status;
339 339 };
340 340
341 341 /* Status values for yppushresp_xfr.status */
342 342
343 343 #define YPPUSH_SUCC (1) /* Success */
344 344 #define YPPUSH_AGE (2) /* Master's version not newer */
345 345 #define YPPUSH_NOMAP (-1) /* Can't find server for map */
346 346 #define YPPUSH_NODOM (-2) /* Domain not supported */
347 347 #define YPPUSH_RSRC (-3) /* Local resouce alloc failure */
348 348 #define YPPUSH_RPC (-4) /* RPC failure talking to server */
349 349 #define YPPUSH_MADDR (-5) /* Can't get master address */
350 350 #define YPPUSH_YPERR (-6) /* YP server/map db error */
351 351 #define YPPUSH_BADARGS (-7) /* Request arguments bad */
352 352 #define YPPUSH_DBM (-8) /* Local dbm operation failed */
↓ open down ↓ |
303 lines elided |
↑ open up ↑ |
353 353 #define YPPUSH_FILE (-9) /* Local file I/O operation failed */
354 354 #define YPPUSH_SKEW (-10) /* Map version skew during transfer */
355 355 #define YPPUSH_CLEAR (-11) /* Can't send "Clear" req to local */
356 356 /* ypserv */
357 357 #define YPPUSH_FORCE (-12) /* No local order number in map - */
358 358 /* use -f flag. */
359 359 #define YPPUSH_XFRERR (-13) /* ypxfr error */
360 360 #define YPPUSH_REFUSED (-14) /* Transfer request refused by ypserv */
361 361 #define YPPUSH_NOALIAS (-15) /* Alias not found for map or domain */
362 362
363 -#ifdef __STDC__
364 363 extern bool xdr_datum(XDR *, datum *);
365 364 extern bool xdr_ypdomain_wrap_string(XDR *, char **);
366 365 extern bool xdr_ypmap_wrap_string(XDR *, char **);
367 366 extern bool xdr_ypreq_key(XDR *, struct ypreq_key *);
368 367 extern bool xdr_ypreq_nokey(XDR *, struct ypreq_nokey *);
369 368 extern bool xdr_ypreq_xfr(XDR *, struct ypreq_xfr *);
370 369 extern bool xdr_ypreq_newxfr(XDR *, struct ypreq_newxfr *);
371 370 extern bool xdr_ypresp_val(XDR *, struct ypresp_val *);
372 371 extern bool xdr_ypresp_key_val(XDR *, struct ypresp_key_val *);
373 372 extern bool xdr_ypmap_parms(XDR *, struct ypmap_parms *);
374 373 extern bool xdr_ypowner_wrap_string(XDR *, char **);
375 374 extern bool xdr_yppushresp_xfr(XDR *, struct yppushresp_xfr *);
376 375 extern bool xdr_ypresp_order(XDR *, struct ypresp_order *);
377 376 extern bool xdr_ypresp_master(XDR *, struct ypresp_master *);
378 377 extern bool xdr_ypall(XDR *, struct ypall_callback *);
379 378 extern bool xdr_ypresp_maplist(XDR *, struct ypresp_maplist *);
380 379
381 -#else
382 -
383 -extern bool xdr_datum();
384 -extern bool xdr_ypdomain_wrap_string();
385 -extern bool xdr_ypmap_wrap_string();
386 -extern bool xdr_ypreq_key();
387 -extern bool xdr_ypreq_nokey();
388 -extern bool xdr_ypreq_xfr();
389 -extern bool xdr_ypreq_newxfr();
390 -extern bool xdr_ypresp_val();
391 -extern bool xdr_ypresp_key_val();
392 -extern bool xdr_yp_inaddr();
393 -extern bool xdr_ypmap_parms();
394 -extern bool xdr_ypowner_wrap_string();
395 -extern bool xdr_yppushresp_xfr();
396 -extern bool xdr_ypresp_order();
397 -extern bool xdr_ypresp_master();
398 -extern bool xdr_ypall();
399 -extern bool xdr_ypresp_maplist();
400 -#endif /* __STDC__ */
401 -
402 380 #ifdef __cplusplus
403 381 }
404 382 #endif
405 383
406 384 #endif /* _RPCSVC_YP_PROT_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX